ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting an adjacent column (https://www.excelbanter.com/excel-programming/382926-selecting-adjacent-column.html)

[email protected]

Selecting an adjacent column
 
Hi,

I have two columns of data, the first column has data in every cell
where as the second has some blank cells. Under normal circumstances
the commands

Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select

select these two columns quite successfully.
However if the first cell in the second column is blank e.g.
MDE No. Workgroup
705433605
705433682
705433709
705433717
705433719
705433754
705433755
705433757
705433762 10-JIC5D
705433833
705434007 10-JIC5D

then the selection goes all the way to the last column in the sheet.
How can I select just the adjacent column in this case?


Charles Chickering

Selecting an adjacent column
 
Range(Selection,Selection.End(xlDown)).Resize(,2). Select
--
Charles Chickering

"A good example is twice the value of good advice."


" wrote:

Hi,

I have two columns of data, the first column has data in every cell
where as the second has some blank cells. Under normal circumstances
the commands

Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select

select these two columns quite successfully.
However if the first cell in the second column is blank e.g.
MDE No. Workgroup
705433605
705433682
705433709
705433717
705433719
705433754
705433755
705433757
705433762 10-JIC5D
705433833
705434007 10-JIC5D

then the selection goes all the way to the last column in the sheet.
How can I select just the adjacent column in this case?




All times are GMT +1. The time now is 08:36 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com