Hi All:
I have a spreadsheet that has all the data I need but the column headings are not in the right order to transmit to the vendor. I am trying to copy and paste the columns I need to a range in the same sheet called "FORMAT". I started building this macro based on info from the net but I get a "Type Mismatch" error when I run it. I need the macro to find the column headers and then copy the data in that column to the new range. The code I have so far is below. Thanks for any help.
Dim Cell As Range
Dim iCol As Integer
Set Cell = Sheets("Import").Range("IMPORT").Find("LNAME", "FNAME", "GENDER", "ENTITY") '/These are the column headers
If Cell Is Nothing Then
MsgBox "Unable to fin Header"
Exit Sub
Else
iCol = Cell.Column
End If
With Sheets("Import")
.Range(Cells(1, iCol).Cell(Rows.Count, iCol).End(xlUp)).CopytoRange = ("FORMAT")
End With
End Sub
Bookmarks