PC Review


Reply
Thread Tools Rate Thread

Count number of Rows with Value

 
 
=?Utf-8?B?U3R1ZGVudA==?=
Guest
Posts: n/a
 
      30th Oct 2006
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 With Quote
 
 
 
 
=?Utf-8?B?ZXhjZWxlbnQ=?=
Guest
Posts: n/a
 
      30th Oct 2006
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?
>

 
Reply With Quote
 
=?Utf-8?B?Q2hhcmxlcyBDaGlja2VyaW5n?=
Guest
Posts: n/a
 
      30th Oct 2006
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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count Number of Rows Boying Opaw Microsoft Excel Worksheet Functions 1 8th Oct 2009 04:46 AM
Count Number of Rows Hoffma Microsoft Excel Worksheet Functions 0 14th May 2009 03:32 PM
COUNT NUMBER OF ROWS =?Utf-8?B?S2VlcCBJdCBTaW1wbGUgU3R1cGlk?= Microsoft Excel Worksheet Functions 2 9th Feb 2007 06:54 PM
Count number of rows, where non relevant rows are hidden =?Utf-8?B?UGlldGVy?= Microsoft Excel Misc 2 8th Nov 2006 12:24 PM
Count rows and insert number to count them. =?Utf-8?B?TWV4?= Microsoft Excel Misc 6 23rd Aug 2006 02:29 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:30 PM.