View Single Post
  #5   Report Post  
Old January 28th 09, 03:08 PM posted to microsoft.public.excel.programming
vbnewbie vbnewbie is offline
external usenet poster
First recorded activity by ExcelBanter: Jan 2009
Posts: 19
Default find empty cells in a column then append row that empty cell i

Hello again

I am submitting this from a macro and get the following error

" RunTime error 9 subscript out of range"

And when I open the debugger the line


is in error


"Bernard Liengme" wrote:

I am assuming: (1) the column is A, and (2) you want to start at row 1.
This subroutine looks at column A on Sheet2 and on Sheet3 in column A it
lists the row number of every empty cell. The Sheet3 could be copied to a
text file or saved as a TXT file.
best wishes

Sub ListEmpty()
lastcell = Cells(Cells.Rows.Count, "A").End(xlUp).Row
For j = 1 To lastcell
If Cells(j, 1) = "" Then
k = k + 1
Sheets("Sheet3").Cells(k, 1) = j
End If
Next j
End Sub

Bernard V Liengme
Microsoft Excel MVP
remove caps from email

"vbnewbie" wrote in message
I am trying to read all empty cells in a column then append the rows that
cells are in to a text file using VB6
Microsoft EXCEL 2003