Copy non-contiguous selection from workbook to another workbook

Issue

I copy data from workbook to another workbook ,copying of single contiguous selection works without problem.
But, If I copied two selections (using CTRL) , even adjacent , nothing copied to the destination workbook (with no error raised).
How to adapt the below code to make it Copy non-contiguous selection from workbook to another?
In advance, grateful for useful answer and comments.

    Dim wb As Workbook: Set wb = ThisWorkbook    'Source Workbook
    Dim srg As Range: Set srg = wb.ActiveSheet.Range(Selection.Address)
 
    Dim wb1 As Workbook: Set wb1 = Workbooks.Add  'Destination Workbook
    Dim drg As Range: Set drg = wb1.Sheets(1).Range("A1")
 
    srg.Copy drg
    srg.Copy
    drg.PasteSpecial Paste:=xlPasteColumnWidths
 
    Dim r As Range
      For Each r In drg.Rows
        r.WrapText = True
         If r.RowHeight < 40 Then r.RowHeight = 40  'This line works
           Next r

Solution

This answer refers to @karma
Just I need to copy columns width then copy values after it.

srg.Copy
drg.PasteSpecial Paste:=xlPasteColumnWidths
srg.Copy drg

Answered By – Waleed

Answer Checked By – Mildred Charles (AngularFixing Admin)

Leave a Reply

Your email address will not be published.