ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select range (https://www.excelbanter.com/excel-programming/417260-select-range.html)

Basta1980

Select range
 
Hi,

Is there an addition to the code;

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

so that if there is just 1 blanco row or column included (range is A:G,
column B is blanco) columns C:G are included?!

joel

Select range
 
Set LastRow = Cells(Rows.Count,Selection.Column).end(xlup)
Set LastCell = LastRow.End(xltoright)
Set FirstCell = LastRow.end(xlup)
Range(FirstCell,LastCell).select

"Basta1980" wrote:

Hi,

Is there an addition to the code;

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

so that if there is just 1 blanco row or column included (range is A:G,
column B is blanco) columns C:G are included?!


Basta1980

Select range
 
Hi Joel,

Thanx for the tip, but excel still doesnt jump over the blanco column so
that columns C:G are also included in the selection.

"Joel" wrote:

Set LastRow = Cells(Rows.Count,Selection.Column).end(xlup)
Set LastCell = LastRow.End(xltoright)
Set FirstCell = LastRow.end(xlup)
Range(FirstCell,LastCell).select

"Basta1980" wrote:

Hi,

Is there an addition to the code;

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

so that if there is just 1 blanco row or column included (range is A:G,
column B is blanco) columns C:G are included?!


joel

Select range
 

Set LastRow = Cells(Rows.Count,Selection.Column).end(xlup)
Set LastCell = Cells(LastRow,Columns.Count).End(xltoleft)
Set FirstCell = LastRow.end(xlup)
Range(FirstCell,LastCell).select



"Basta1980" wrote:

Hi Joel,

Thanx for the tip, but excel still doesnt jump over the blanco column so
that columns C:G are also included in the selection.

"Joel" wrote:

Set LastRow = Cells(Rows.Count,Selection.Column).end(xlup)
Set LastCell = LastRow.End(xltoright)
Set FirstCell = LastRow.end(xlup)
Range(FirstCell,LastCell).select

"Basta1980" wrote:

Hi,

Is there an addition to the code;

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

so that if there is just 1 blanco row or column included (range is A:G,
column B is blanco) columns C:G are included?!



All times are GMT +1. The time now is 01:19 PM.

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