Selecting column within a selection

  • Thread starter Thread starter don
  • Start date Start date
D

don

I would like to select a column within a selection.

For instance if the original selection is A1:D10

I would like to select D1:D10 and then manipulate the data.

I have tried many ideas but none seem to work.

For instance why doesn't the following select the first cell in the
last column of the selection. It selects a cell outside the selection
entirely.

Selection(Cells(1, Selection.Columns.Count)).Select

In addition, isn't the selection the range itself?
Msgbox selection.address
gives the correct address of the original selection.

Thanks for any help.

Don
 
Don,

Selection.Cells(1, Selection.Columns.Count).Select
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"don" <[email protected]>
wrote in message
I would like to select a column within a selection.

For instance if the original selection is A1:D10
I would like to select D1:D10 and then manipulate the data.
I have tried many ideas but none seem to work.
For instance why doesn't the following select the first cell in the
last column of the selection. It selects a cell outside the selection
entirely.

Selection(Cells(1, Selection.Columns.Count)).Select

In addition, isn't the selection the range itself?
Msgbox selection.address
gives the correct address of the original selection.
Thanks for any help.
Don
 
With Selection
..Range(Cells(1, .Columns.Count),
Cells(.Rows.Count, .Columns.Count)).Select
End With

Selects D1:D10 when A1:D10 is the original selection

Ken Johnson
 
I'm not sure what you're doing, but maybe these will give you some more
alternative:

ActiveSheet.Range("a1:d10").Select
Selection.Columns(1).Offset(0, 3).Select

==

ActiveSheet.Range("a1:d10").Select
Selection.Columns(4).Select

==

ActiveSheet.Range("a1:d10").Select
With Selection
.Columns(.Columns.Count).Select
End With
 

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

Back
Top