Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 13
Default Loop QUESTION to end of data range...

HI:
Can you tell me how to loop to the end of the data range without this
being static?
Please

numrows = Range("A2", Range("A2").End(xlDown)).Rows.Count
Range("A2").EntireColumn.Select

For x = 1 To 3000

Thanks so much

Just need to go to the end value which will change everytime the report
is ran by user

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 7,247
Default Loop QUESTION to end of data range...

Try something like the following:

Dim FirstRow As Long
Dim LastRow As Long
Dim RowNdx As Long

FirstRow = 2
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
For RowNdx = FirstRow To LastRow
' do something
Next RowNdx

By the way, the worksheet.functions newsgroup is not the best place for
VBA-related questions. It is for worksheet formula questions. The
programming newsgroup is the place for VBA questions.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)



"mniccole" wrote in message
ups.com...
HI:
Can you tell me how to loop to the end of the data range without this
being static?
Please

numrows = Range("A2", Range("A2").End(xlDown)).Rows.Count
Range("A2").EntireColumn.Select

For x = 1 To 3000

Thanks so much

Just need to go to the end value which will change everytime the report
is ran by user



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,886
Default Loop QUESTION to end of data range...

Hi

numrows = Cells(Rows.Count, 1).End(xlUp).Row
will find the last used row number in column 1 (column A)

Range("A" & numrows).Select
will take you to that last cell used in column A.
If you want the first empty one after last used then

Range("A" & numrows + 1).Select

--
Regards

Roger Govier


"mniccole" wrote in message
ups.com...
HI:
Can you tell me how to loop to the end of the data range without this
being static?
Please

numrows = Range("A2", Range("A2").End(xlDown)).Rows.Count
Range("A2").EntireColumn.Select

For x = 1 To 3000

Thanks so much

Just need to go to the end value which will change everytime the
report
is ran by user



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
Macro question Chris Excel Worksheet Functions 12 July 7th 06 01:23 AM
Inputting data to one worksheet for it effect another daedalus1 Excel Discussion (Misc queries) 1 June 25th 06 04:39 PM
Add a data series dynamically to a named range? Popeye Charts and Charting in Excel 3 March 10th 06 08:59 PM
Match and Sort for two range of data on different worksheets? Tan New Users to Excel 3 March 9th 06 08:55 AM
Match function...random search? Les Excel Worksheet Functions 10 July 28th 05 11:54 AM


All times are GMT +1. The time now is 02:00 AM.

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"