Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
i would do it my way :-)
MsgBox ("") & WorksheetFunction.CountA(Range("A1:X500")) "Student" skrev: 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? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The answer to your question is to set the range that you are searching in the
first place: ws.Range("A1:X500").Find(...) -- Charles Chickering "A good example is twice the value of good advice." "Student" wrote: 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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Count Number of Rows | Excel Worksheet Functions | |||
COUNT NUMBER OF ROWS | Excel Worksheet Functions | |||
Count how many Rows ago a particular number was hit | Excel Worksheet Functions | |||
Count number of rows, where non relevant rows are hidden | Excel Discussion (Misc queries) | |||
Count rows and insert number to count them. | Excel Discussion (Misc queries) |