VBA Copy

mt

Board Regular
Joined
Feb 24, 2006
Messages
134
Is there a way to set the copy range in the correct sequence? In this code, I want the data to copy in the same order as I have set the copy range from left to right. It seems to always revert back to the same order that it was in the worksheet. In this case, I want the Company Code in Column A in the Destination sheet, but it keeps ending up last.

Thanks
Mike

Code:
With Worksheets("Data1")
            Set rngH = .Range("T4")                                     'Company Code
            Set rngA = .Range("B4")                                     'Parcel
            Set rngCopy = Union(rngH, rngA.Resize(, 2))                 'Lot
            Set rngCopy = Union(rngCopy, rngA.Offset(, 17))             'TaskCode
            Set rngCopy = Union(rngCopy, rngA.Offset(, 10).Resize(, 2)) 'Task,Date,ActualDate
            rngCopy.Copy
            Worksheets("Report1").Range("A" & ToRow).PasteSpecial Paste:=xlPasteValues
        
    End With
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hi

how about
with worksheets("Dat11")
dim arr(5)
arr(0) = range("T4")
arr(1) = range("B4")
arr(2) = range("D4")
arr(3) = range("S4")
arr(4) = range("L4")
arr(5) = range("M4")
worksheets("report1").range("a" & torow).resize(1,6) = arr

Not sure about the copy ranges....


Tony
 
Upvote 0

Forum statistics

Threads
1,215,013
Messages
6,122,690
Members
449,092
Latest member
snoom82

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