Results 1 to 10 of 10

Copy Selected Columns to Same Sheet

Threaded View

  1. #1
    Registered User
    Join Date
    04-26-2011
    Location
    Texas
    MS-Off Ver
    Excel 2007
    Posts
    48

    Copy Selected Columns to Same Sheet

    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
    Last edited by egavasrg; 10-25-2011 at 04:06 PM. Reason: Issue solved

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1