go to first blank cell

R

raymondsum

Hi,

I just want to go to first blank cell (eg A3) in a specified column. If
I used Selection(x1Down), then it goes to A2, not A3.
How to write macro to go to A3?

Column A
A1 3
A2 4
A3
A4 5
 
N

Nick Hodge

Raymond?

Using your exact example, the following would work

Sub FirstBlank()
Selection.End(xlDown).Offset(1, 0).Select
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
 
A

Alan Beban

More generally to select the first blank cell in Column A:

Sub FirstBlank()
Range("A:A").Find("", Range("A:A")(Range("A:A").Rows.Count)).Select
End Sub

Or more succinctly for the operative command,

Sub FirstBlank()
Dim rng As Range
Set rng = Range("A:A")
rng.Find("", rng(rng.Rows.Count)).Select
End Sub

Both of the above assume that the relevant sheet is the active sheet
when the procedure is run.

Alan Beban
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top