Identifying & Selecting an Unknown Range?
Tryout ActiveSheet.UsedRange:
Play with this little peice of code:
Sub Macro3()
MsgBox (ActiveSheet.UsedRange.Address)
End Sub
If you have data in B2 thru D4 ( a small 3x3 block), then the macro will
return
$B$2:$D$4. You can capture the info as a string and then use it as a range
later:
dim s as string, r as range
s=ActiveSheet.UsedRange.Address
..
..
..
r=Range(s)
--
Gary's Student
"Don G" wrote:
Assume data entered from B4 (known point) to unknown Column (Y). Data will
be entered in many rows. Also assume that Col B is used to establish last
row used and that last row returns as (X). Would like to find and select
Range(B4:YX).
Have found and tried a couple of codes doing a search in the forumn that
seemed to address this but have not been able to get any of them tweaked.
I'm using 2003, if that matters. Hope this is clear enough. Thanks for any
help here.
|