Quantcast
Channel: MATLAB Central Newsreader Recent Posts
Viewing all articles
Browse latest Browse all 19628

Using VBA commands to insert blank rows between data

$
0
0
Hi there,

I'm trying to get Matlab to function through actxserver and then insert a variable number of rows between other data in the spreadsheet.

So far I have been able to make it delete data that has been found:

*productfile and item_selected are defined in another GUI and stored with set/getappdata and recalled to the program successfully
*editrange is a variable that is calculated after the program uses regexp to find data that matches what the user has entered; it is the length of the data that need to be deleted


excel = actxserver('Excel.Application')
Workbook = excel.Workbooks.Open(productfile)
Sheet = get(excel.sheets, 'item', item_selected)
Sheet. Activate
ran = excel.Activesheet.get('Range', editrange)
del = ran.Delete
invoke(Workbook, 'SaveAs', productfile)
invoke(excel, 'Quit')
delete(excel)

This all works fine, the problem appears when I now need to insert new data, from another file. This data is not guaranteed to be of the same size, so I planned to first insert the calculated number of new rows, then xlswrite to them.

thanks!

Viewing all articles
Browse latest Browse all 19628

Trending Articles