Range selecting cells

A

Alec H

Hi,

I have a line of code that identifies the last active row of a
worksheet, ready for a new record to be added.


Code:
--------------------


Range("A65536").End(xlUp).Offset(1, 0).Select


--------------------


For example purposes assume that that new row is row 30.

How do I then tell Excel to move to column J in row 30, not stay in
column A?

I cant just change the range selection to J because not all rows have
inputs in row J but all new entries do have a column A entry.
 
D

davesexcel

Find first empty row in a column
Sub Tst2()
Dim varnbrows As Double
Range("A1").Select
varnbrows = Selection.CurrentRegion.Rows.Count
If Selection.Value = "" Then
Exit Sub
ElseIf Selection.Offset(1, 0).Value = "" Then
Selection.Offset(1, 0).Select
Else
Selection.Offset(varnbrows, 0).Select
End If
End Sub

this will take you to the first empty cell in column A

Change the column by changing Range("A1") to whatever column you prefer
 
Top