I want to copy the particular columns to worksheet2.
The following macro is working fine.
But if I need to select the "type" column of "O" first.
And then move the columns of name , address , nature to worksheet2
How can i modified the following macro...
thanks
...
====
The following macro is working fine.
But if I need to select the "type" column of "O" first.
And then move the columns of name , address , nature to worksheet2
How can i modified the following macro...
thanks
...
====
Code:
<code>Sub MoveColumns()
Dim wsO As Worksheet
Dim wsF As Worksheet
Dim i As Integer
Application.ScreenUpdating = False
Set wsO = Worksheets("worksheet2")
Set wsF = Worksheets("worksheet2")
myColumns = Array("Name", "Addr", "Nature", "type")
With wsO.Range("A1:AG1")
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</code>