hi i need to copy columns from sheet1 to sheet2 in a certain order i have this macro it works fine with 4 or 5 entry but i need to enter this amount of entrys and i get an error runtime error 13 type mismatch how can i resolve this problem
A,z,B,z,C,z,z,D,z,z,z,z,z,z,z,z,z,z,z,z,E,F,z,z,G,z,z,z,z,z,z,H,z,z,z,z,z,z,z,z,z,z,z,z,
z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,j,z
incase anyone can improve my code z is a blank column that i am using to space the columns so they are in the correct placement
A,z,B,z,C,z,z,D,z,z,z,z,z,z,z,z,z,z,z,z,E,F,z,z,G,z,z,z,z,z,z,H,z,z,z,z,z,z,z,z,z,z,z,z,
z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,z,j,z
Code:
Sub copypaste()
Dim s As String, i As Long, X
s = InputBox("Enter From column letters separated by comma, e.g. A,C,AA")
X = Split(s, ",")
For i = LBound(X) To UBound(X)
Sheets("Sheet1").Columns(X(i)).Copy Destination:=Sheets("Sheet2").Cells(1, i + 1)
Next i
deleteheader
End Sub
incase anyone can improve my code z is a blank column that i am using to space the columns so they are in the correct placement