There are several "neat" ways to do this.
But quite a bit depends on your specific situation.

for instance,

If the sheet contains ONLY the information you are interested in,
(as in:  Rows 1-500 contain data and the rest of the worksheet is blank)
and column "C" ALWAYS has a value,

You can use:

nRows = Application.Worksheetfunction.counta(activesheet.Range("C1:C65000"))

then to select them, use:
Range(cells(1,"C"),Cells(nrows,"C")).Select


Some people like to use something like:

LastRow = Range("C65000").End(xlUp).Row

and others like:

ActiveCell.SpecialCells(xlLastCell).Select

the bad thing about this one (xlLastCell) is that the "Last Cell" is determined 
by
the maximum cells used during a session.
If you read in 6000 rows of data and delete 5000 rows,
xlLastCell will still show row 6000 until you save and exit the file.
when you open the file, xlLastCell will then be 1000...


There are more ways (many more than I care to enumerate!)

Basically, you need to select your poison.
You need to determine the last cell based on YOUR requirements,
then you can select them.

good luck,

Paul


________________________________
From: Tommy <jntwh...@verizon.net>
To: MS EXCEL AND VBA MACROS <excel-macros@googlegroups.com>
Sent: Wed, November 11, 2009 10:03:27 AM
Subject: $$Excel-Macros$$ cell selection


In a macro, I would like to be able to select a group of contiguous
cells containing information, where I know the location of the first
cell but not the location of the last cell in the group. I also know
that the only cells in the column containing information are in the
group of cells to be selected. Is there a neat way to do this?

Tommy


--~--~---------~--~----~------------~-------~--~----~
----------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe
-~----------~----~----~----~------~----~------~--~---

Reply via email to