Need to Find the End Of Spreadsheet

travelingwilly

New Member
Joined
Jun 19, 2002
Messages
24
Hello Folks

I wish to read a spreadsheet that may have blanks. I am able to read to the end of a Sheet by using....
With Sheets("PLANBUILD").Range("a1", Range("a1").End(xlDown))
For tst = 1 To .Rows.Count
... do work work with .cells(tst,1 ) ....
Next tst

That works great if there are no blanks in col A in any rows. But Now I have a formated sheet. where I have a code on line 1 cell 1 and data line 2 ,3 4, 5 but not in row 1. The abouve will go to the first record and stop. How can I find the rowcount of active rows or somthiong like that
<table border=1>
example
<tr><td>parta</td><td>descr</td></tr>
<tr><td></td><td>information 1</td></tr>
<tr><td></td><td>information 2</td></tr>
<tr><td></td><td>information3</td></tr>
<tr><td>partb</td><td>descr</td></tr>
<tr><td></td><td>information 1</td></tr>
<tr><td></td><td>information 2</td></tr>
<tr><td></td><td>information3</td></tr>
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Hi,

You could find the last row like this:

Sub FindLastRow()
Dim LastRow As Long
If WorksheetFunction.CountA(Cells) > 0 Then
'Search for any entry, by searching backwards by Rows.
LastRow = Cells.Find(What:="*", After:=[A1], _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
MsgBox LastRow
End If
End Sub

This was taken from the VBA / Ranges section of Dave Hawley's site. Give it a try!
http://www.ozgrid.com/

HTH
 
Upvote 0

Forum statistics

Threads
1,224,889
Messages
6,181,606
Members
453,055
Latest member
cope7895

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top