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

BeckyCPY

New Member
Joined
Nov 26, 2018
Messages
3
Hi, i have encountered a problem to select the columns from B4:E4 to P4:T4. Below is my intial code but it does not work.

Union(Range("B4:E4"), Range("P4:T4")).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy 'P
Call uidoc.Paste


Please help!!! I need to use Range(Selection, Selection.End(xlDown)).Select method.
 

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.
Code:
Call uidoc.Paste
What exactly is above line supposed to be doing?
What is uidoc?
Is it a procedure? If it is, please post it
 
Last edited:
Upvote 0
Hi, just ingore the Call unidoc.Paste.

Basically, I want to select different column values (B4:E4 & P4:T4) and use Range(Selection, Selection.End(xlDown)).Select and then copy the selected range. Yet, i got stuck in selecting those columns.
 
Upvote 0
Using the autofilter in the begining as below:

Sheets("Accrued book position").Select
Worksheets("Accrued book position").Select
ActiveSheet.Range("$A$4:$T$4").AutoFilter Field:=2, Criteria1:=Array("Bond", "Frn", "Total"), Operator:=xlFilterValues


Range("B4:O4").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy 'P
Call uidoc.Paste

Range("B4:E4,P4:T4").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy 'P
Call uidoc.Paste
 
Upvote 0
You are confusing me
- let's go back to the original post
- we can deal with anything else after answering your 1st question

Does the message box return the correct range?
Code:
    Dim rng As Range
    Set rng = Range("B4", Range("B" & Rows.Count).End(xlUp))
    Set rng = Union(rng.Resize(, 4), rng.Offset(, 14).Resize(, 5))
    MsgBox rng.Address(0, 0)
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

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