Count number of Rows with Value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to thank you up front

I am trying to count the number of rows used in an excel sheet

Dim ws as Worksheet
Set ws = Application.ActiveSheet
Dim LastRow as long

LastRow = ws.Cells.Find(What:="*", _
SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row

This code finds any data found in the row from column A till the last
activated column. however I want the find method to find data in the row from
column A to X only.
How may I set the find method to search for data from column A to X for the
first 500 rows? Is that possible?
 
i would do it my way :-)
MsgBox ("") & WorksheetFunction.CountA(Range("A1:X500"))


"Student" skrev:
 
The answer to your question is to set the range that you are searching in the
first place:
ws.Range("A1:X500").Find(...)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top