Cell selection by macro
Cell selection by macro
(OP)
I have a macro which selectas a predefined set of rows on a worksheet. I would like to know how to have this macro select only those rows appearing above the first empty row or above the row with a certain value in column A.
Any tips are appreciated.
Any tips are appreciated.





RE: Cell selection by macro
targetvalue = Cells(1, 4).Value
endrow = Columns("A:A").Find(targetvalue).Row
Rows("1:" & endrow).Select
RE: Cell selection by macro
=OFFSET(Sheet1!$A$1,0,0,COUNTA(Sheet1!$A:$A))
MyRange will always refer to the filled cells from A1 downwards, and you can refer directly to it in VB, by
Range("MyRange").Select
See other threads in this forum, and John Walkenbach's site (and many others) for dynamic named ranges (that is what MyRange is in this example).
Good luck!
Cheers,
Joerd
Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
RE: Cell selection by macro
I just recently started working with named ranges. The dynamic named range is new to me, looks like a powerful tool, thanks joerd.