View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Per Jessen Per Jessen is offline
external usenet poster
 
Posts: 1,533
Default Sub to copy n paste special discontiguous ranges from 1 sht to


Hi Max

Try if this is what you need:

Sub CopyPaste1()
Dim shA As Worksheet
Dim shB As Worksheet

Set shA = Sheets("Credit MIS")
Set shB = Sheets("Asia")
CopyFromRngArray = Split(("H7:H10, H14:H17, H21:H28, H31, H35:H38,
H42:H48"), ",")
NextCol = shB.Range("IV7").End(xlToLeft).Column + 1

For c = 0 To UBound(CopyFromRngArray)
DestRow = Range(CopyFromRngArray(c)).Cells(1, 1).Row
shA.Range(CopyFromRngArray(c)).Copy
shB.Cells(DestRow, NextCol).PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Next
Application.CutCopyMode = False
End Sub

Best regards,
Per

"Max" skrev i meddelelsen
...
Joel, thanks for your response. The earlier problem was the intervening
merged rows in-between in the source sheet: Credit MIS and in the
destination
sheet: Asia. I've removed all of the merged rows and basically just want
to
do this:

Copy the range H7:H48 in Credit MIS (it's a fixed range to copy)
Paste special as values into "Asia"'s next available col range,
to the right of the last filled col range,
starting the paste identically in row 7
(eg if last filled col range in Asia is G7:G48, sub to paste it into
H7:H48)

Grateful if you could help with a sub to do the above