excel - Creating and Transposing Array in VBA -
i'm hoping load values in range array , transpose array location (different workbook)
i using below forum post idea of how it:
below code working now, , i'm getting 1004 object defined error. can spot doing wrong?
i did find code works if not set trangearray , instead sheets("sheet1").range("c12:c19).value = application.transpose(myarray)
, i'm not sure why that's different code.
sub copy_data() dim crange range, arange range, trange1 range, wbk1 workbook, wbk2 workbook dim myarray() variant, trangearray range set wbk1 = thisworkbook myarray = range("e12:l12") set trangearray = wbk1.sheets("sheet1").range("c12:c19") sheets("sheet1").range(trangearray).value = application.transpose(myarray)
as mentioned in comments, use:
trangearray.value = application.transpose(myarray)
sheets("sheet1").range(trangearray).value
not working, because range
accepts either single parameter - string range address (not range itself): range(addr)
, either 2 parameters - top left , bottom right cells: range(cell_1,cell_2)
Comments
Post a Comment