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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Do Until and Selecting the Range?

Status
Not open for further replies.

66tigger40

Technical User
May 26, 2004
108
GB
Hi

I have a spreadsheet that I have the following code running:

Do Until IsEmpty(ActiveCell)

ActiveCell.Offset(1, 0).Select

Loop
End Sub

Which works fine but I need it to select all the cells until it reaches an Empty cell - I'm sure it's really simple but i can't figure it out today

Thanks in advance

N
 
It's best to avoid activating each cell. That slows down your code.

But to answer your question, to select all cells until the first empty one, try this:
Code:
range(activecell, activecell.end(xldown)).select

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ181-2886 before posting.
 
Hi

Thanks for the quick response - just one more quick question - how would i now copy this information to another sheet or workbook?

Thanks in advance

N
 
Have a look at the Copy method of the Range object.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top