Sub to copy n paste special discontiguous ranges from 1 sht to ano
I don't know what determines each set of ranges. I assumed there was a blnk
in column H "Credit MIS" top determine the where each range ends. See if
this helps.
Sub CopyPaste1()
RowCount = 2
StartRow = RowCount
With Sheets("Credit MIS")
'check if there is a blank in column H
If .Range("H" & (RowCount + 1)) = "" Then
.Range("H" & StartRow & ":H" & RowCount).Copy
With Sheets("Asia")
LastRow = .Range("A" & Rows.Count).End(xlUp).Row
LastCol = .Cells(LastRow, Columns.Count).End(xlToLeft)
.Cells(7, LastCol + 1).PasteSpecial _
Paste:=xlPasteValues
End With
'add two to skip blank in column H
StartRow = RowCount + 2
End If
RowCount = RowCount + 1
End With
End Sub
"Max" wrote:
Seeking help to modify the sub below
to resolve the issues (1) & (2) remarked
Thanks for insights
Sub CopyPaste1()
Sheets("Credit MIS").Range("H7:H10").Copy
Sheets("Asia").Select
Range("IV7").Select
Selection.End(xlToLeft).Select
'(1). need the selection above to offset 1 col to the right
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
'(2). need to repeat the above copy n paste operation
'for other source ranges in "Credit MIS" viz:
'H14:H17
'H21:H28
'H31
'H35:H38
'H42:H48
End Sub
|