excel vba - VBA: Getting run-time 1004: Method 'Range' of object '_Worksheet' failed -


i assigning worksheet variable make easier work with. other actions take on object (compare , writes) work, can't put border around range. gives me 1004 error range method failed. doing wrong here?

code in question (the last line debugger triggers):

dim destrow range     dim lastrow long     dim target worksheet     dim listsize long      listsize = me.featurenumber_listbox.listcount     set target = activeworkbook.worksheets("mysheet")     lastrow = target.cells(rows.count, "a").end(xlup).row + 1      ' put borders around whole row     target.range(cells(lastrow, 1), cells(lastrow, 19)).borders.linestyle = xlcontinuous 

thanks

use target.cells not cells because otherwise cells context isn't want be?


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -