Next clear cell in a table

jamienwood

Board Regular
Joined
Apr 14, 2002
Messages
133
I know it can be done and its probably really easy but does anyone know how to get to the next clear cell in a column, and select it. For example

Sub NextClearCell()
Range("A1").Select
Selection.End(xlDown).Select
End

This will take me to the last cell with something in but how do i get to the next empty cell???
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi
Maybe this?

Sub NextClearCell()
Range("A1").Select
Selection.End(xlDown).Activate
Range("A" & ActiveCell.Row + 1).Select
End Sub

Tom
This message was edited by TsTom on 2002-04-25 05:03
 
Upvote 0
Sub NextClearCell()
Dim LastRow
NextRow = Range("a1:a" & Range("A65536").End(xlUp).Row).Rows.Count + 1
Cells(NextRow, 1).Select
End Sub

Joe,
I tried yours and it selects the last used cell of the range.
This one does work.
 
Upvote 0
cheers for your help so far but when i tried to change this code so it works on column E instead of A it will find the next clear row but selects the next clear row in column A even if the data is in E
This is what i changed from

Sub NextClearCell()
Dim LastRow
NextRow = Range("a1:a" & Range("A65536").End(xlUp).Row).Rows.Count + 1
Cells(NextRow, 1).Select
End Sub

to

Sub NextClearCell()
Dim LastRow
NextRow = Range("E1:E" & Range("E65536").End(xlUp).Row).Rows.Count + 1
Cells(NextRow, 1).Select
End Sub
 
Upvote 0
Sub NextClearCell()
Dim LastRow
NextRow = Range("E1:E" & Range("E65536").End(xlUp).Row).Rows.Count + 1
Cells(NextRow, 5).Select
End Sub



Culprit = Cells(NextRow, 1).Select
where 1 = column 1
change to 5

Tom
 
Upvote 0
Thanks TsTom that works wonders it also works if you replace the column reference number (After [NextRow, #]) with the letter in "" e.g. "E". Just incase anyone ever needs this, because it is really useful!!

Sub NextClearCell()
Dim LastRow
NextRow = Range("E1:E" & Range("E65536").End(xlUp).Row).Rows.Count + 1
Cells(NextRow, "E").Select
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,494
Messages
6,113,988
Members
448,538
Latest member
alex78

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top