LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Selecting rows using defined reference as end row

Hi everyone,

I need to select and copy a group of cells starting at row 3 and
continuing to the last row in my table. Since the last row can vary
between spreadsheets, I'm using a Loop function which finds the row
with value "Grand Total" (the last row) and defines that row number as
"RowCounter". Here's what it looks like:

Account = "Empty"
RowCounter = 0
Cells(RowCounter, 1).Activate

Do Until Account = "Grand Total"
Account = Worksheets("SOE All Roles").Cells(RowCounter,1).Value
If Account = "Grand Total" Then
RowCounter = RowCounter
Else
RowCounter = RowCounter + 1
End If

Cells(RowCounter, 1).Activate
Account = Worksheets("SOE All Roles").Cells(RowCounter,1).Value
Loop


This is leaving me with "RowCounter" defined as the last row, which is
what I wanted. Can anyone tell me how to now select all rows between
row 3 and my "RowCounter" row? I tried this, but I'm getting an
error:

Rows("3:RowCounter").Select
 
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
Selecting cells using a defined reference [email protected] Excel Programming 1 May 7th 08 01:41 AM
Selecting a range defined in a cell Alex Excel Programming 9 July 2nd 07 04:22 PM
after selecting 50 rows of a column i can't reference the cells in the rows Bob Salzer New Users to Excel 2 July 21st 06 10:29 PM
Selecting a Whole User Defined Row Using VBA Mikey2005 Excel Programming 2 February 8th 06 05:14 PM
Selecting a defined Name via a cell's contents PCLIVE Excel Programming 9 July 14th 05 06:38 PM


All times are GMT +1. The time now is 09:44 PM.

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"