SO I have this script that searches for a list of columns in a sheet and then pastes them to another sheet in order of the list. However, I can't seem to get it to paste somewhere other than Col1 on the destination sheet. I tried adjusting the # values for (x,y) in the Destination:=wsF.Cells section.
How do I direct this to paste in something like the 8th column, Col H?
How do I direct this to paste in something like the 8th column, Col H?
VBA Code:
Sub CopyCols() 'copy paste columns
Dim wsO As Worksheet
Dim wsF As Worksheet
Dim i As Integer
Application.ScreenUpdating = False
Set wsO = Worksheets("RawData")
Set wsF = Worksheets("FormatingSheet")
myColumns = Array("Col4", "Col3", "Col7", "Col1")
With wsO.Range("D1:M1")
For i = 0 To UBound(myColumns)
On Error Resume Next
.Find(myColumns(i)).EntireColumn.Copy Destination:=wsF.Cells(1, i + 1)
Err.Clear
Next i
End With
Set wsO = Nothing
Set wsF = Nothing
Application.ScreenUpdating = True
End Sub