VBA Delete Range Content Error -


i want clear contents of column b line 2 last filled cell. working several open workbooks @ same time need make sure correct range gets deleted. when use code i'm getting error 1004 - run time error:

workbooks("bo_settings.xlsm").activate intlastrow = _     workbooks("bo_settings.xlsm") _         .worksheets(strcurrentsheet).usedrange.rows.count  workbooks("bo_settings.xlsm") _     .worksheets(strcurrentsheet).range( _           cells(2, 2) _         , cells(intlastrow, 2) _     ).clearcontents 

what doing wrong?

you need specify cell using inside range.

dim ws worksheet set ws = workbooks("bo_settings.xlsm").worksheets(strcurrentsheet)  range(ws.cells(2,2), ws.cells(intlastrow,2)).clearcontents 

Comments