ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Find first blank row in worksheet to import data from txt file (https://www.excelbanter.com/excel-discussion-misc-queries/123062-find-first-blank-row-worksheet-import-data-txt-file.html)

DDK

Find first blank row in worksheet to import data from txt file
 
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.

JMB

Find first blank row in worksheet to import data from txt file
 
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

"DDK" wrote:

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.



All times are GMT +1. The time now is 05:59 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com