Assign multiple non-continuous cells to desired cells

Prevost

Board Regular
Joined
Jan 23, 2014
Messages
198
Hi There. I believe I had this working last week but I cannot remember what I had (or if it actually worked as I wanted it). I want to assign cell values in a non-continuous range, to other cells in a non-continuous range. The code should show exactly what I want to do. I want the values of cells B1, B3 and B5 to equal the values of cells A1, A3, and A5 respectively.
Thanks!

Code:
Sub test()
    Range("b1,b3,b5").Value = Range("a1,a3,a5").Value
End Sub
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
This seems to work...by just declaring the range as one cell...but I still don't think that's what I did...

Code:
Sub test()
    Range("b1:b1", "b3:b3").Value = Range("a1:a1", "a3:a3").Value
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,250
Messages
6,171,036
Members
452,374
Latest member
keccles

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