Copying Three selection within loop

keithkemble

Board Regular
Joined
Feb 15, 2002
Messages
160
This procedure works ( Thanks to help from Barrie Davidson)
I now want to add two further cell selections to the main range selection

Adding the two cells with in the range by bracketing or using the , only appear to cause the selection to become the first cell in range to the last cell in range

Any help would be appreciated
I have ' the section requiring help

Sub cmr()
Dim i
i = 15
' To select condition c in column e then place in sheet cmr at A15
Sheets("mobile").Select
Range("e15").Select
For Each X In Range("E15", Range("E16").End(xlDown))
If X = "" Then Exit For
If UCase(ActiveCell.Value) = "C" Then
Sheets("mobile").Activate
Range("A" & i).Select
Range("A" & i & ":H" & i).Select ' This is where I want add ("y" & i) plus ("CF" & i)
Selection.Copy
Sheets("cmr").Select
Range("A15").Select
Sheets("cmr").Select
Range("A2000").End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlValues
Sheets("mobile").Select
i = Selection.Row + 1
ElseIf UCase(Activecel.Value) <> "C" Then
i = Selection.Row + 1
Range ("E" & i)
End If
Next
Sheets("mobile").Select
Range("E15").Select
End Sub
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Keith, change:

Range("A" & i & ":H" & i).Select

to read:
Range("A" & i & ":H" & i & ",Y" & i & ",CF" & i).Select

Note that when you paste this it will be in columns A:J.
 
Upvote 0
That doen't work.

I have tried Range (Range (), Range(), Range() ).select
No joy,

Range( Range as above ).select
No joy

I wonder if it should be ton three seperate lines with activat as the key

KK
 
Upvote 0
Keith, I tested that code and it worked okay for me. It selected the cells in row (i) in columns A:H, column Y, and column CF. Did you try copying it and pasting it in your code?
 
Upvote 0
Barrie,
Thanks a million. That works a treat.
I placed the , left of the quote on the additional ranges.

Ps I was working on 2 machines.

It runs sweetly on both.

Thanks again
 
Upvote 0

Forum statistics

Threads
1,223,276
Messages
6,171,140
Members
452,381
Latest member
Nova88

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