+ Reply to Thread
Results 1 to 3 of 3

Macro to select specific columns in the same workbook

  1. #1
    Registered User
    Join Date
    12-01-2016
    Location
    Maryland
    MS-Off Ver
    2010
    Posts
    1

    Macro to select specific columns in the same workbook

    Hello,

    I have a workbook with thousands of columns and I only need to extract a few for an analysis. I would like to choose specific columns, copy them, and paste them into the same workbook and sheet and delete the rest of them. I also need to delete multiple rows of data. This is what I have so far:

    Set range1 = Range("A:A, P:P, O:O, S:S, CE:CE, CL:CL, CP:CP, FL:FL")
    range1.Copy
    Set newbook = Workbooks.Add
    ActiveCell.PasteSpecial Paste:=xlPasteValues
    Rows("3:400").EntireRow.Delete
    Rows("601:998").EntireRow.Delete
    Rows("1199-1596").EntireRow.Delete

    This macro copies and pastes the data into a new workbook and I do not need to do that. Also, I need column P to come before column O, and this macro is not doing that. Finally, all of the rows I need to delete are not deleting. Only rows 3-400 are deleting and not the rest. This macro needs to be applied to many other data sets. Anyt help?

    Thank you!

  2. #2
    Forum Contributor
    Join Date
    10-19-2012
    Location
    Omaha, Nebraska USA
    MS-Off Ver
    Excel 2010
    Posts
    249

    Re: Macro to select specific columns in the same workbook

    Issky,

    Here is code that should do what you describe.

    Please Login or Register  to view this content.
    Hope that helps,

    Dan

  3. #3
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Macro to select specific columns in the same workbook

    Please Login or Register  to view this content.
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

+ 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. [SOLVED] Import specific columns from workbook A sheet1 to workbook B Sheet 2 to specific columns
    By Vassen in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-14-2016, 07:01 AM
  2. [SOLVED] Copy Select Columns from closed workbook into active workbook
    By 3345james in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-09-2015, 02:04 PM
  3. Macro to copy data from specific columns and paste to new workbook
    By jcs2811 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-09-2014, 10:15 PM
  4. Replies: 8
    Last Post: 04-04-2013, 08:02 PM
  5. Select & Copy Specific Images to another workbook
    By B_B in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-25-2013, 12:00 AM
  6. [SOLVED] Macro to group columns based on specific criteria in entire workbook
    By kbkumar in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-09-2012, 04:47 AM
  7. [SOLVED] Macro to Transfer Specific Columns from One workbook to another
    By luke.guthrie in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 05-16-2012, 11:07 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