Find first blank row in worksheet to import data from txt file

D

DDK

I am trying to import data into a worksheet on a weekly basis. I need to
access the specific worksheet, find the first blank row on that worksheet to
import the next weeks data into the worksheet. I got the import but not
finding the first blank row and specifying that as the starting ppint for the
imort.
 
J

JMB

The first empty cell in Column A:

Dim lngRow As Long
With Worksheets("Sheet1")
lngRow = .Cells(.Rows.Count, 1).End(xlUp).Row + 1
End With

assuming there is nothing in the very last row of Column A. If that is a
concern you could test it:

Dim lngRow As Long
With Worksheets("Sheet1")
If IsEmpty(.Cells(.Rows.Count, 1)) Then
lngRow = .Cells(.Rows.Count, 1).End(xlUp).Row + 1
Else: MsgBox "No last cell in Column A"
End If
End With
 
Top