Select range

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?!
 
J

Joel

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

Basta1980

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.
 
J

Joel

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
 

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

Similar Threads


Top