Select range

  • Thread starter Thread starter Basta1980
  • Start date Start date
B

Basta1980

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?!
 
Set LastRow = Cells(Rows.Count,Selection.Column).end(xlup)
Set LastCell = LastRow.End(xltoright)
Set FirstCell = LastRow.end(xlup)
Range(FirstCell,LastCell).select
 
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.
 
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
 
Back
Top