Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Simple Count problem


Obviously new to VBA.

I want to run a while function depending on the number of rows on
second sheet. ex..

a = 1
While a <= Sheet(2).rows.count
a = a + 1
...
this doesn't work. Any help. Thanks much

--
Paul98
-----------------------------------------------------------------------
Paul987's Profile: http://www.excelforum.com/member.php...fo&userid=2485
View this thread: http://www.excelforum.com/showthread.php?threadid=51735

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Simple Count problem

One way:

This will loop through all rows based on row count of column A and assumes
row 1 is a header; adjust starting value of r (=2) and column as required.

Dim lastrow as Long, r as long

lastrow=Sheet(2).Cells(rows.count,"A").end(xlup).r ow
For r=2 to lastrow
.......

Next r

HTH

"Paul987" wrote:


Obviously new to VBA.

I want to run a while function depending on the number of rows on a
second sheet. ex..

a = 1
While a <= Sheet(2).rows.count
a = a + 1
...
this doesn't work. Any help. Thanks much.


--
Paul987
------------------------------------------------------------------------
Paul987's Profile: http://www.excelforum.com/member.php...o&userid=24850
View this thread: http://www.excelforum.com/showthread...hreadid=517357


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Simple Count problem


very nice. thank you.


--
Paul987
------------------------------------------------------------------------
Paul987's Profile: http://www.excelforum.com/member.php...o&userid=24850
View this thread: http://www.excelforum.com/showthread...hreadid=517357

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple Count of certain cells JPDS Excel Worksheet Functions 7 January 15th 10 02:45 PM
Getting 2 different answers for simple count Access Joe Excel Worksheet Functions 3 September 9th 09 12:59 PM
Simple problem, simple formula, no FUNCTION ! Ron@Buy Excel Worksheet Functions 6 September 28th 07 04:51 PM
Simple count function berminator Excel Worksheet Functions 4 July 1st 05 02:46 PM
simple count or sum function?? Looker Excel Programming 1 November 5th 03 04:48 PM


All times are GMT +1. The time now is 10:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"