Excel VBA Copy/Paste Range to the next available cell in another worksheet -
what want do: filter on array, copy filtered data onto different workbook. copy data pasted onto worksheet in same workbook, time below existing data.
my thinking: code used below used me copy , paste 1 workbook workbook , worked perfectly,
wb.sheets("2014 current week").range("c2:cc10000").copy nwb.sheets("2014 ytd").range("c" & rows.count).end(xlup).offset(1, 0)
but seems not work same way if want copy in same workbook. appreciated. thanks!
dim wb workbook dim strs string dim str string dim nwb workbook set wb = thisworkbook strs = wb.sheets("macros").range("h5") 'the 2014 address can found in full in cell h5 in macros tab set nwb = workbooks.open(strs) 'address of new workbook , opens activesheet .autofiltermode = false 'filter , here' end nwb.sheets("all data").range("a1:ca100000").copy wb.sheets("2014 current week").range("c" & rows.count).end(xlup) 'this 1 works, , copies want 2014 current week tab wb.sheets("2014 current week").range("c2:cc10000").copy wb.sheets("2014 ytd").range("c" & rows.count).end(xlup).offset(1, 0) 'this 1 doesn't work, , not copy or paste @ 2014 current week 2014 ytd tab of same workbook
your code looks , should not have issues. since seems not working, need @ actual worksheets
, data involved.
you using end
find last row of data. given this, worth testing yourself. go last row of worksheet
in column c
, hit ctrl + up. show data going pasted.
based on description last row issue. since there stray data affecting end
.
Comments
Post a Comment