Range(Selection, Selection.End(xlUp)).Select to stop at row 2 and not include header rows.

bensko

Board Regular
Joined
Mar 4, 2008
Messages
173
I'm sure there is a simple solution to this, but I am having trouble finding the right one.

Any way to have Range(Selection, Selection.End(xlUp)).Select stop at row 3 and disregard the two header rows.

Something like Range(Selection, Selection.End(xlUp)-2).Select

Thanks in advance,

Ben
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Hi,
I would just stop and check:

Code:
Range(Selection, Selection.End(xlUp)).Select
If Selection.Row < 3 Then
    Cells(3, Selection.Column).Select
End If

ξ
 
Upvote 0
Note, or better (to preserve selection size):

Code:
Range(Selection, Selection.End(xlUp)).Select
If Selection.Row < 3 Then
    Selection.Offset(3 - Selection.Row, ).Select
End If

Test first - I may have the syntax wrong.
 
Upvote 0
I did have the syntax wrong, and I think we want to resize the selection as well, so, try again:

Code:
Sub foo()

Range(Selection, Selection.End(xlUp)).Select
If Selection.Row < 3 Then
    Selection.Offset(3 - Selection.Row).Resize( _
        Selection.Rows.Count - (3 - Selection.Row), Selection.Columns.Count) _
        .Select
End If


End Sub
 
Upvote 0
Sorry for my delayed appreciation - thank you!! This is exactly what I was looking for.

I did have the syntax wrong, and I think we want to resize the selection as well, so, try again:

Code:
Sub foo()

Range(Selection, Selection.End(xlUp)).Select
If Selection.Row < 3 Then
    Selection.Offset(3 - Selection.Row).Resize( _
        Selection.Rows.Count - (3 - Selection.Row), Selection.Columns.Count) _
        .Select
End If


End Sub
 
Upvote 0

Forum statistics

Threads
1,214,324
Messages
6,118,892
Members
448,854
Latest member
Eduard_Stoo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top