selecting non blank columns

N

noel

Hi,

I was hoping someone could help me with this problem.

I have a spreadsheet where each cell in the first row
contain a heading. The following rows contain actual data,
which may or may not be present.

Is there a way to select the row containing the headings,
as well as all other rows and columns that contain values.
 
C

Chip Pearson

Noel,

Do you mean programmatically? Try something like

Range("A1").CurrentRegion.Select
 
P

Paul Simon

Hi Noel,

I'm assuming you mean an automated method vs. manually selecting the
area using your mouse or keyboard cursor keys.

Place your mouse pointer in any cell within the database. (This can
be anywhere within the data or the headings - it makes no difference.)

Do the menu sequence Edit>GoTo. When the GoTo dialog box comes up,
click the Special Button.

On the next dialog box, click Current Region and click OK.

If you do this often, there is a Current Region toolbar button you can
place on one of your toolbars.

Do Tools>Customize. In the Commands tab choose Edit from the
Categories pane on the left. Then in the Commands pane on the right,
scroll all the way down til you see the Select Current Region icon.
Click and drag it up to one of your toolbars. From that point on,
from anywhere within a database structure, you can simply click that
button to highlight the entire database including the headings.

Lastly, you can use the keyboard shortcut keys Ctrl+Shirt+*
(You must use the * over the 8 in the typing area of the keyboard, not
the * on the numeric keypad.)

I hope this helps.
Paul
 
A

Alan Beban

Neither Chip Pearson's nor Paul Simon's method will work if there are
rows or columns in your data that are completely blank. Perhaps
something like the following will work, where datarange is a named range
that encompasses all your data:

Range("datarange").SpecialCells(xlCellTypeConstants).Select

Alan Beban
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top