syntax question this time, kind of a spinoff from my question about using a variable for countif
worksCode:WorksheetFunction.Sum(Sheet21.Range("H1045:H1555"))
fails with a 400 errorCode:WorksheetFunction.Sum(Sheet21.Range(Cells(1045,8),Cells(1555,8)))
but
this works. firstrow and rowindex are integer variables, vals is a range variable. by works i mean it sets the value fine, it isn't meant to do the same thing as the first two. noting this one b/c it lets me use cells(), whereas the other did notCode:Set vals = Range(Cells(firstrow, 11), Cells(rowindex - 1, 11))
so my question here is with regard to using the Cells() object to denote the cell references within a range. i assume the failed case has something to do with referencing a range from a different sheet. how can i correct this?
the reason i need to use cells() rather than "A1:B5" or something like that, is b/c i need a variable range, so i want toss a variable into Cells()




Reply With Quote
