+ Reply to Thread
Results 1 to 2 of 2

Select columns and copy them into a new Excel file

Hybrid View

  1. #1
    Registered User
    Join Date
    02-21-2014
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    1

    Select columns and copy them into a new Excel file

    Hello,

    I need a Makro in which I can select/specify multiple (as many as I want) columns via an inputform (e.g. columns B, C, E, J, K, AC). These selected columns are then to be copied into a new Excel file, in which they are displayed right next to each other (e.g. old "B" becomes A, old "C" becomes B and so on).

    Thank you very much for your help.

    Best
    Tobitop1

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Select columns and copy them into a new Excel file

    Does this help?

    Sub tobitop1()
    Dim ws As Worksheet
    Dim x As String
    Dim y As Long
    Dim z As Long
    Set ws = ActiveSheet
    y = InputBox("Please Enter the Number of Columns too Transfer")
    Workbooks.Add
    ActiveWorkbook.SaveAs "New Excel File" & ".xls"
    z = Workbooks("New Excel File.xls").Sheets("Sheet1").UsedRange.Columns.count
    On Error Resume Next
    Do Until y = 0
    ws.Activate
    x = InputBox("Please Enter a Columns to Transfer")
    Cells(1, x).EntireColumn.Copy Workbooks("New Excel File.xls").Sheets("Sheet1").Cells(1, z + 1)
    y = y - 1
    z = z + 1
    Loop
    On Error GoTo 0
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 10-29-2013, 02:05 PM
  2. Open 2nd file(CSV) from cell reference, copy columns to main file & close 2nd file
    By Langchop in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-31-2013, 05:09 AM
  3. Copy-Paste Macro of 3 columns from multiple excel files into one summary file
    By jpmaster53 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-15-2012, 07:10 AM
  4. Replies: 9
    Last Post: 06-04-2012, 08:00 AM
  5. Select case & copy to a different file
    By Jokacave in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-14-2010, 08:35 AM

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