Results 1 to 4 of 4

Change order of columns when pasted?

Threaded View

  1. #1
    Registered User
    Join Date
    06-04-2013
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    42

    Question Change order of columns when pasted?

    I have a macro that pulls columns A,C,D,F from sheets"database" and pastes them in A,B,C,D in sheet1 . The problem is, I don't want them pulled and pasted in that order, I want them instead to be in a different order. Is there a way to paste them in a different order?
    I just want to swap the last two columns so that it looks like this: database column A goes to sheet1 colum A, database column C goes to sheet1 column B, database column F goes to sheet 1 column C and database column D goes to sheet 1 columnD

    Here is the macro, it is also located in the worbook under the "runreport" module. THanks in advance everyone!!

    Option Explicit
    'A,C,D,F
    Sub RunSort()
        Sheets("Sheet1").[a2:a1000].ClearContents
            ' Display header
            Sheets("Sheet1").Columns("A:A").ColumnWidth = 10.88
            Sheets("Sheet1").Range("A1") = "Part No."
            Sheets("Sheet1").Columns("B:B").ColumnWidth = 7.14
            Sheets("Sheet1").Range("B1") = "Line Item"
            Sheets("Sheet1").Columns("C:C").ColumnWidth = 11.63
            Sheets("Sheet1").Range("C1") = "Cust. Date"
            Sheets("Sheet1").Columns("D:D").ColumnWidth = 7.86
            Sheets("Sheet1").Range("D1") = "Qty."
        Sheets("Database").[a1:a1000].AutoFilter 1, "030-17081-1"
        Sheets("Database").Range("A2:A1000,C2:C1000,D2:D1000, F2:F1000").Copy Sheets("Sheet1").Range("A65536").End(xlUp)(2)
        Sheets("Database").[a1].AutoFilter
    End Sub
    Last edited by cronerd; 09-23-2013 at 06:06 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] VBA to detect change in order number, then add a value to each 1st line of that order
    By Marijke in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-04-2013, 09:19 AM
  2. Change order of Legend without changing the order of the chart
    By Grimace in forum Excel Charting & Pivots
    Replies: 6
    Last Post: 11-22-2012, 11:53 AM
  3. [SOLVED] The order data is pasted is the wrong way around with my macro
    By Imnotgoodwithnames in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-20-2012, 02:00 PM
  4. [SOLVED] password protected document with hidden columns, columns appear when copy-pasted
    By onarol@gmail.com in forum Excel General
    Replies: 2
    Last Post: 04-04-2006, 08:25 AM
  5. Replies: 0
    Last Post: 05-19-2005, 04:06 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