Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default count number of rows (variable range)


Hi,

well, needless to say that I am quite new to VBA... anyway.

I have a worksheet containing lots of data and to avoid people enterin
crap created a VBA Macro showing a GUI so that new valid data can b
entered.

every row has a unique number consiting of year+month+number; i.e
200508003 for the third entry in August 2005.

As every entry adds a new row to the worksheet in question i need som
way to
read all rows in that worksheet and filter and count the ones matchin
the actual month to generate a new valid ID.

well... i tried lots of range, count etc already but can't even devis
a way for this growing number of rows... any ideas? posts that ar
helpful?

thanks

--
Acid-Sk
-----------------------------------------------------------------------
Acid-Sky's Profile: http://www.excelforum.com/member.php...fo&userid=2650
View this thread: http://www.excelforum.com/showthread.php?threadid=39771

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default count number of rows (variable range)

Here is a formula to calculate it

=MAX(IF(LEFT(A1:A100,6)="200508",A1:A100))+1

which is an array formula, so commit with Ctrl-Shift-Enter

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Acid-Sky" wrote in
message ...

Hi,

well, needless to say that I am quite new to VBA... anyway.

I have a worksheet containing lots of data and to avoid people entering
crap created a VBA Macro showing a GUI so that new valid data can be
entered.

every row has a unique number consiting of year+month+number; i.e.
200508003 for the third entry in August 2005.

As every entry adds a new row to the worksheet in question i need some
way to
read all rows in that worksheet and filter and count the ones matching
the actual month to generate a new valid ID.

well... i tried lots of range, count etc already but can't even devise
a way for this growing number of rows... any ideas? posts that are
helpful?

thanks!


--
Acid-Sky
------------------------------------------------------------------------
Acid-Sky's Profile:

http://www.excelforum.com/member.php...o&userid=26502
View this thread: http://www.excelforum.com/showthread...hreadid=397715



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default count number of rows (variable range)


Hi,

I think I understand your answer and it is perfect for using the cells
but it is not exactly what I am trying to do. Furthermore it doesn'
take into account that I just don't know how many rows there are (a
their numbe ris dynamic). Could be 10 rows or 20.000...

And how can I use this in VBA?

Thanks :

--
Acid-Sk
-----------------------------------------------------------------------
Acid-Sky's Profile: http://www.excelforum.com/member.php...fo&userid=2650
View this thread: http://www.excelforum.com/showthread.php?threadid=39771

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default count number of rows (variable range)

cRows = Cells(Rows.Count,"A").End(xlUp).Row

so the next free nrow would be cRows+1

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Acid-Sky" wrote in
message ...

Hi,

I think I understand your answer and it is perfect for using the cells,
but it is not exactly what I am trying to do. Furthermore it doesn't
take into account that I just don't know how many rows there are (as
their numbe ris dynamic). Could be 10 rows or 20.000...

And how can I use this in VBA?

Thanks :)


--
Acid-Sky
------------------------------------------------------------------------
Acid-Sky's Profile:

http://www.excelforum.com/member.php...o&userid=26502
View this thread: http://www.excelforum.com/showthread...hreadid=397715



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
count of number of rows within a range with a certain text cooey Excel Worksheet Functions 5 May 13th 10 08:18 PM
count number of dates in a row of cel before or after a variable d TBA Excel Worksheet Functions 5 April 22nd 09 03:08 AM
Count in a variable range Ron@Buy Excel Worksheet Functions 4 September 27th 07 08:24 AM
Linking to a Variable Number of Rows - XP/07 RFJ Excel Worksheet Functions 4 May 17th 07 07:53 PM
Count rows and insert number to count them. Mex Excel Discussion (Misc queries) 6 August 23rd 06 02:29 AM


All times are GMT +1. The time now is 12:18 AM.

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

About Us

"It's about Microsoft Excel"