+ Reply to Thread
Results 1 to 16 of 16

Rearrange columns in new excel sheet in desired sequence

  1. #1
    Forum Contributor
    Join Date
    10-01-2015
    Location
    Delhi
    MS-Off Ver
    2013
    Posts
    105

    Rearrange columns in new excel sheet in desired sequence

    Hi Friends

    Everyday I receive multiple excel files which are not in desired sequence columns, every time I have to create a new excel sheet and had to copy/paste the columns in new sheet in desired sequence. Can you suggest me of macro which will get it done automatically.
    Attached Files Attached Files

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Rearrange columns in new excel sheet in desired sequence

    Have you tried recording a macro?
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Forum Contributor
    Join Date
    10-01-2015
    Location
    Delhi
    MS-Off Ver
    2013
    Posts
    105

    Re: Rearrange columns in new excel sheet in desired sequence

    I received data from different files and dont how in that situation how to record a macro which will solve this issue.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Rearrange columns in new excel sheet in desired sequence

    Open the worbook as received. When you start recording, you have the option of saving the macro in the active workbook or in Personal. Choose Personal.

    Then you can run it on each file as you receive them.

  5. #5
    Forum Contributor
    Join Date
    10-01-2015
    Location
    Delhi
    MS-Off Ver
    2013
    Posts
    105

    Re: Rearrange columns in new excel sheet in desired sequence

    I feel this will not work. Kindly look at my attachment, the files I received have data in columns which are not in arranged way. I want that data to be coped in desired columns are presented, and recording macro is not solving the issue.

    Kindly have a look at my attachment.

  6. #6
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,567

    Re: Rearrange columns in new excel sheet in desired sequence

    If you don't "feel" like doing something yourself, you can always pay someone to do the work for you.
    Just click on "Commercial Services" at the top.

  7. #7
    Forum Contributor
    Join Date
    10-01-2015
    Location
    Delhi
    MS-Off Ver
    2013
    Posts
    105

    Re: Rearrange columns in new excel sheet in desired sequence

    Opps...my words are miss interpreted. I did that but when I am running the macro its not generating the result. This is what I wanted to say. I Didnt intended to put across my statement in wrong way.

  8. #8
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Rearrange columns in new excel sheet in desired sequence

    Can you rearrange the file by dragging columns left and right into the desired order?

  9. #9
    Forum Contributor
    Join Date
    10-01-2015
    Location
    Delhi
    MS-Off Ver
    2013
    Posts
    105

    Re: Rearrange columns in new excel sheet in desired sequence

    Well that is manual work which I do on all the 200 files I received everyday. I was trying to see if this manual work can be automated. I receive files where some files have 10 columns from which I just need to pull 6columns, some will have 8columns again from which I just need to pull 6columns.

    I have to pull those 6columns from each file and I was keen to have a automated way for this manual task.

  10. #10
    Forum Contributor
    Join Date
    10-01-2015
    Location
    Delhi
    MS-Off Ver
    2013
    Posts
    105

    Re: Rearrange columns in new excel sheet in desired sequence

    Experts Kindly look into the issue

  11. #11
    Forum Contributor
    Join Date
    10-01-2015
    Location
    Delhi
    MS-Off Ver
    2013
    Posts
    105

    Re: Rearrange columns in new excel sheet in desired sequence

    Basically, I have several sheets in my workbook where only the second and third worksheets are being used. I want to copy columns from the second sheet to the third sheet only if the column headings match. For example, the code will check the first row of sheet2 to check if it matches any of strings in an array and if it matches, it will copy the entire column to the third sheet under the same heading.

  12. #12
    Forum Contributor
    Join Date
    10-01-2015
    Location
    Delhi
    MS-Off Ver
    2013
    Posts
    105

    Re: Rearrange columns in new excel sheet in desired sequence

    Or in Simple words - Copying from sheet to sheet if column headings match

  13. #13
    Forum Contributor
    Join Date
    10-01-2015
    Location
    Delhi
    MS-Off Ver
    2013
    Posts
    105

    Re: Rearrange columns in new excel sheet in desired sequence

    Need some help on this code...Currently this code Copy data from one sheet to another by matching column header but it is doing only one header(first name), I need to get it done for other 2headers also(last name,country name)...kindly help to modify the code to embed this requirement in the code


    Option Explicit
    Sub Test()
    Dim ched, phed, lr As Long
    Sheets("Sheet1").Select
    ched = Application.WorksheetFunction.Match("First Name", Sheets("Sheet1").RANGE("1:1"), False)
    phed = Application.WorksheetFunction.Match("First Name", Sheets("Sheet2").RANGE("1:1"), False)

    lr = Sheets("Sheet1").Cells(Rows.Count, ched).End(xlUp).Row

    RANGE(Cells(2, ched), Cells(lr, ched)).Copy Sheets("Sheet2").Cells(2, phed)
    Sheets("Sheet2").Select

    RANGE(Cells(2, phed), Cells(Rows.Count, phed).End(xlUp)).NumberFormat = "DD/MM/YY"

    End Sub

  14. #14
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,567

    Re: Rearrange columns in new excel sheet in desired sequence

    You could try this on a copy of your Workbook

    Please Login or Register  to view this content.
    Please use code tags when you have code in your post.
    Last edited by jolivanes; 11-04-2015 at 01:52 AM. Reason: code tags request

  15. #15
    Forum Contributor
    Join Date
    10-01-2015
    Location
    Delhi
    MS-Off Ver
    2013
    Posts
    105

    Re: Rearrange columns in new excel sheet in desired sequence

    Thanks Jolivanes. Thanks for the support.
    Last edited by harman83; 11-04-2015 at 03:41 AM.

  16. #16
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,567

    Re: Rearrange columns in new excel sheet in desired sequence

    Glad to hear it worked for you.
    Good luck

+ 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. Facing problem while saving data in desired cell in excel sheet from your form
    By Harmeet Singh in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 11-23-2013, 03:39 AM
  2. How To Compare Two Excel Sheets & Get Desired Result In Third Sheet!!
    By bmiguy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-14-2013, 12:30 AM
  3. Macro to copy values from columns of one sheet & paste it to diffrnt Column Sequence
    By kmvasudha in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-06-2013, 06:54 AM
  4. [SOLVED] Can anyone please advise how to auto-rearrange rows of data, based on desired arrangement?
    By richardlimka in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-21-2012, 09:26 PM
  5. Replies: 16
    Last Post: 01-25-2012, 09:27 AM
  6. Replies: 0
    Last Post: 07-14-2011, 11:21 AM
  7. Replies: 0
    Last Post: 04-27-2005, 07:06 PM
  8. Replies: 0
    Last Post: 04-27-2005, 07:06 PM

Tags for this Thread

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