Copy, past special values, offset 1 column for multiple ranges.

Rysieks

New Member
Joined
Aug 7, 2014
Messages
2
I am trying to take multiple ranges and essentially copy, paste special values one column over to the left. I’ve tried a few approaches, the lines with apostrophe in front are my failed attempts. Any help is much appreciated.

Code:
Sub CopyRange_MoveLeft ()
 
Dim rngUnion As Range, rng1 As Range, rng2 As Range, rng3 As Range, rng4 As Range, _
rng5 As Range, rng6 As Range, rng7 As Range, rng8 As Range, rng9 As Range, rng10 As Range
Dim rng As Range
 
Set rng1 = Range("D3")
Set rng2 = Range("D9:G10")
Set rng3 = Range("D14:G15")
Set rng4 = Range("D19:G20")
Set rng5 = Range("D24:G25")
Set rng6 = Range("D29:G30")
Set rng7 = Range("D34:G35")
Set rng8 = Range("D39:G40")
Set rng9 = Range("D44:G45")
Set rng10 = Range("D19:G20")
Set rngUnion = Union(rng1, rng2, rng3, rng4, rng5, rng6, rng7, rng8, rng9, rng10)
 
‘ Failed attempts below…
'rngUnion.Copy Destination:=ActiveSheet.Cells.Offset(0, -1)
 
'rng.Copy Destination:=Cells.Offset(0, -1)
 
'For Each rng In rngUnion
'    .Cut Destination:=.Offset(0, -1)
'    Next
   
End Sub
 
Hi and Welcome to MrExcel,

You can step through each Area of a non-contiguous range like this...
Code:
Dim iArea As Integer

For iArea = 1 To rngUnion.Areas.Count
   With rngUnion.Areas(iArea).Cells
      .Copy
      .Offset(0, -1).PasteSpecial (xlPasteValues)
   End With
Next iArea
 
Upvote 0

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