Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to select an unspecified range in a worksheet

Status
Not open for further replies.

cassidybklyn

Programmer
Apr 23, 2007
82
US
Hi everybody,
I working with vb6 and I currenlty have a spreadsheet with data up to the range of (A2:G143) that requires sorting. But I do not want to hard code this range because the range of data in the spreadsheet may change at anytime (either more data or less data). How can I tell it to choose the appropriate range at any given time based on the amount of data in the spreadsheet?

For example:
range(A2:??????)
Thanks.
Cassidy
 



Hi,
Code:
SheetObject.[A2].CurrentRegion.Sort..........



Skip,

[glasses] [red][/red]
[tongue]
 
You may try to sort the range returnrned by Range("A2").CurrentRegion

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks guys. I'll try it out on monday in the office.
Enjoy your weekend.
Cassidy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top