View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Locating the row that has no values. Selecting that row till the l

Sub Delete_Past_LastCell()
Dim RealLastRow As Long
Dim RealLastColumn As Long
On Error Resume Next
RealLastRow = _
Cells.Find("*", Range("A1"), , , xlByRows, xlPrevious).Row
RealLastColumn = _
Cells.Find("*", Range("A1"), , , xlByColumns, xlPrevious).Column
set rng = Cells(RealLastRow, RealLastColumn).Offset(1,0)
range(rng,cells(rows.count,1)).EntireRow.Delete
End Sub

--
Regards,
Tom Ogilvy

"VB Script for Excel" wrote:

Everyday, I get a file that has several rows and columns with data. I
wanted to build a macro that can locate first row after the data that
has no values in any cells. Then, i want to select thar row (lets say
row 105) and select it till the last row i.e. 65536 or so. And then
delete those. (yes, although it doens't have any values, i still need
to delete those once)

Please help. I think there should be some loop function that can locate
the row that has no values. Then select it up to 65000th row and delete
those.

It's really getting hard to figure it out.

Thanks