sa31
04-26-2018, 06:58 PM
Trying to just move data to another worksheet for columns with specified column names
With ThisWorkbook.Worksheets("Sheet1")
Dim ar As Variant
Dim i As Integer
Dim j As Long
ar = Array("Header1", "Header2") 'define header names to move
For i = 0 To UBound(ar)
j = [A1:AW1].Find(ar(i)).Column
Columns(j).Copy Sheet2.Cells(1, i + 1) 'copy to sheet2 from sheet1
Next I
End With
End Sub
But I still keep running into issues and can't debug
With ThisWorkbook.Worksheets("Sheet1")
Dim ar As Variant
Dim i As Integer
Dim j As Long
ar = Array("Header1", "Header2") 'define header names to move
For i = 0 To UBound(ar)
j = [A1:AW1].Find(ar(i)).Column
Columns(j).Copy Sheet2.Cells(1, i + 1) 'copy to sheet2 from sheet1
Next I
End With
End Sub
But I still keep running into issues and can't debug