Copy paste in certain column order

cortexnotion

Board Regular
Joined
Jan 22, 2020
Messages
150
Office Version
  1. 2013
Platform
  1. Windows
Hi All

Is there a shorter/better way than the below to copy/paste a range in a different column order? I work with much larger ranges that the below so a shorter version would be great.

Thanks!

VBA Code:
LR4 = Workbooks("GATE").Sheets(1) .Range("D" & Rows.Count).End(xlUp).Row
    ThisWorkbook.Sheets("admin").Range("F3:F" & LR4).Value = GATE.Sheets(1).Range("J3:J" & LR4).Value
    ThisWorkbook.Sheets("admin").Range("G3:G" & LR4).Value = GATE.Sheets(1).Range("F3:F" & LR4).Value
    ThisWorkbook.Sheets("admin").Range("H3:H" & LR4).Value = GATE.Sheets(1).Range("G3:G" & LR4).Value
    ThisWorkbook.Sheets("admin").Range("I3:I" & LR4).Value = GATE.Sheets(1).Range("C3:C" & LR4).Value
    ThisWorkbook.Sheets("admin").Range("J3:J" & LR4).Value = GATE.Sheets(1).Range("D3:D" & LR4).Value
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
How about
VBA Code:
Sub cortexnotion()
   Dim Ary As Variant
   Dim LR4 As Long
   
   LR4 = Workbooks("GATE").Sheets(1).Range("D" & Rows.Count).End(xlUp).Row
   Ary = Workbooks("GATE").Sheets(1).Range("C3:J" & LR4).Value2
   
    ThisWorkbook.Sheets("admin").Range("F3:J" & LR4).Value = Application.Index(Ary, Evaluate("row(1:" & LR4 - 2 & ")"), Array(8, 4, 5, 1, 2))
End Sub
 
Upvote 0
@Fluff, nifty thank you. I can see Value2 stops the date format shifting to US format which is useful to know!
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,864
Messages
6,121,981
Members
449,058
Latest member
oculus

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