i trying select cell in excel using vba through use of range function.
i have done many times before using variables specify range instead of numbers.
however, cannot seem select range using cells function.
i know possible have done research , have seen other people's code run using function.
below syntax i'm using try , select range (which 1 cell).
additionally, when run code following message:
"run-time error '1004': method of 'range' of object'_global' failed".
thank , help.
dim item string dim itempaste boolean dim itemcnt integer itemcnt = 1 itempaste = false range("x3").select item = activecell.value if item <> "" range("a18").select if activecell.value = "" activecell.value = item itempaste = true else activecell.offset(1, 0).select end if loop until itempaste = true end if itemcnt = itemcnt + 2 range(cells(1, (21 + itemcnt))).select loop until itemcnt = 11
you're using range type function; cells
call returning range
object already. instead of
range(cells(1, (21 + itemcnt))).select
..try:
cells(1, (21 + itemcnt)).select
if want more explicit:
dim target range set target = cells(1, (21 + itemcnt)) target.select
Comments
Post a Comment