Paste values multiple ranges

Thomazz

New Member
Joined
Dec 28, 2017
Messages
24
Probably a very easy thing to do if you are a bit handy with VBA, but can't figure it out.

I have multiple ranges in a sheet (D19:O19 ; D21:O25 ; D29:O36 ; D42:045 ; about 30 different combinations). I want to select those ranges and make values out of them. I don't mean handselecting them (by pressing Ctrl), I mean Excel should select them for me and then create values out of them.

I'm assuming it's not possible to do it all at once, so I probably need to create some sort of loop.

What's the best way of doing this ?

Thanks a million.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Dim a , rng as range, i as long
a = split ("D19:O19,D21:O25,D29:O36,D42:045",",")
For i = Lbound(a) to ubound(a)
rng(a(i)). select
Next i

The Select is just for example. Don't use it ?
 
Upvote 0
Solution
Is this what you mean
VBA Code:
Dim Rng As Range
For Each Rng In Range("D19:O19,D21:O25,D29:O36,D42:045").Areas
   Rng.Value = Rng.Value
Next Rng
 
Upvote 0

Forum statistics

Threads
1,215,487
Messages
6,125,086
Members
449,206
Latest member
ralemanygarcia

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