vba - Using the Offset Function with dynamic Row number -
looking way make code work:
the idea paste block of data dynamically underneath last used cell of sheet
specifically lookimng way dynamically using offset function
dim sit long set sit = cells(row.count, 1).end(xlup).row data_sheet1.range(data_sheet1.cells(1, icol), data_sheet1.cells(irow, icol)).copy destination:=target_sheet.cells(1, targetcol).offset(sit, 0)
many thanks
sub test() dim sit long sit = cells(row.count, 1).end(xlup).row msgbox (sit) end sub
this error lies; have isolated bit of code
from msdn
set keyword: in vba, set keyword necessary distinguish between assignment of object , assignment of default property of object. since default properties not supported in visual basic .net, set keyword not needed , no longer supported.
see example
dim sit long target_sheet sit = .range("a" & .rows.count).end(xlup).row + 1 end data_sheet1 .range(.cells(1, icol), .cells(irow, icol)).copy _ target_sheet.cells(sit, targetcol) end
Comments
Post a Comment