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

selecting first empty cell in a column

Status
Not open for further replies.

haerion

IS-IT--Management
Sep 13, 2006
130
US
Hi all, I'm trying to do a macro in VBA so that it select the first empty cell in the column A. I know of the one that select the last one that have something in it with the Selection.XlDirection(xlDown).Select
but if after I push the down arrow on my keyboard while recording a macro in the code it select a particular cell, like A45000. The thing is since the number of value can change from one time to another, I need the macro to go with the arrow use on the keyboard instead of predetermined cell. Any help in this regards would be greatly appreciated.

Thanks a lot
 
Have a look at the Offset property 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
 
Something like this?

Range.Offset(1, 0).Select

Seem like Im making an error in that, could you correct me. Sorry, I don't want to bother you :).

Thanks
 
Where in your code are you stuck ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Something along the lines of:

Range("A1").end(xldown).offset(1,0).select

NOTE: that won't work if A1 or A2 is blank.

[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.
 
Cool, I got it to work with this:

Range("A1").Select
Selection.End(xlDown).Select
Selection.Offset(1, 0).Select

range.offset was not working but work great with selection.offset. Thanks for your help guys!!!
 
range.offset was not working
I'd say was misused !
Try simply this to discover what I mean:
Range("A1").Offset(1, 0).Select

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Yep, you right, I always knew you were good, just giving me more proof :)

Good job and thanks again PHV!
 
*ahem*
[wink]

[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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top