Results 1 to 9 of 9

Thread: Need a VBA Macro to re-arrange the Data in a specified format

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2013
    Posts
    81

    Post Need a VBA Macro to re-arrange the Data in a specified format

    Dear All,

    I have two worksheets in the attachment.

    One sheet contains Raw-Data
    Another sheet contains data re-arranged in a different format.

    Is it possible to build a macro to use data from the ("Raw Data" worksheet) and re-arrange it to the ("ReAarrange format" worksheet) format?

    Can some one please help me with the macro?

    Best Regards
    Ammu
    Attached Files Attached Files

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Nov 2013
    Posts
    81

    Re: Need a VBA Macro to re-arrange the Data in a specified format

    Dear All,

    Can someone please help me with the code?

  3. #3
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: Need a VBA Macro to re-arrange the Data in a specified format

    Can you show us what you've attempted so far to help us get started?

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Nov 2013
    Posts
    81

    Re: Need a VBA Macro to re-arrange the Data in a specified format

    Thanks for responding to my thread vbfbryce. I am a commerce graduate and don't have much knowledge about VBA macros, but I tried several times and wasn't able to understand VBA concepts.

    At this point I can do the changes to the existing macros, but I cannot build a new macro from the beginning, since I am not sure how many variables that I need in this situation, should I use loops if yes, then which loop should I be using etc.

    Hence request you to help me with the code only this time.

    Going forward, I will make sure that I do my level best to write the code and test it and if I stuck somewhere, then I will post in this forum. I promise.

    Please help this time.

    Best Regards
    Amrutha

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Nov 2013
    Posts
    81

    Re: Need a VBA Macro to re-arrange the Data in a specified format

    I also request you and forum members to help me understand the VBA concepts step by step in a easy way (any links etc). Please help me guys. I am interested in learning, but since I don't understand these concepts, I am getting demotivated.

    When I am given a task like this, then I will get tensed and don't know what to do.

  6. #6
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: Need a VBA Macro to re-arrange the Data in a specified format

    Not a problem that you "don't have much knowledge." I would suggest starting with a step by step run down of what you're trying to do, both for your own benefit and for the benefit of those of us who might try to help you.

  7. #7
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,440

    Re: Need a VBA Macro to re-arrange the Data in a specified format

    I've taken a look at his file, and it's IMO a lot of work (merged cells, you have to skip rows, you have to access fixed rows and what not).

    at 100% concentration, and not being disturbed during it: at least 1 hour of work
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  8. #8
    Frenzied Member
    Join Date
    Nov 2010
    Posts
    1,470

    Re: Need a VBA Macro to re-arrange the Data in a specified format

    your process is easy to do...but ou will need to have a grounding in what is needed and will need to identify where unambiguous data can be collected.

    The forum is not the best place to learn this, but is a place where the learning can be exposed for the benefit of others.

    If you would like to start to learn about the problem and its solution please PM me and I will take you through what you need to know to solve this problem!

    here to help

  9. #9
    Fanatic Member
    Join Date
    Feb 2013
    Posts
    985

    Re: Need a VBA Macro to re-arrange the Data in a specified format

    When it comes to converting tables into a new format its quite simple and just requires you do it step by step and not be consumed by the project as a whole.

    i havent seen your data but it doesnt matter its always the same story.
    start with the first column on the desired format table, what is it and how do you get the format you need........ write a simple macro to do it

    example it maybe a phone number that needs all the + removed and put into the cell, study the whole column of your raw data and see if you can simply just remove the first character,one your certain if this will work then do just that. To make life easier use Trim() on everything you send into your functions unless for some reason its a bad idea.... cannot think why that would be though

    Code:
    public function GetPhoneNumber(FromData as text) as text
    GetPhoneNumber = Right(FromData, Len(FromData) - 1)' this will get everything except first character
    End Function
    Do this over and over again for all columns, dont worry about the rows, just make sure you can do it for just 1 row

    after you have all the functions done then its simple, you just loop all rows and call each function get the new data and put it in the new sheet

    the most important thing you need to know (apart from VBA itself lol), account for the differences that are likely to appear in the raw data, names with or without prefixes, numbers with or without codes etc, one you know allthe possibilities you can just code it in the functions

    NEVER WORK ON YOUR ORIGINAL RAW DATA ...... just a tip

    Hope this helps a little.
    Yes!!!
    Working from home is so much better than working in an office...
    Nothing can beat the combined stress of getting your work done on time whilst
    1. one toddler keeps pressing your AVR's power button
    2. one baby keeps crying for milk
    3. one child keeps running in and out of the house screaming and shouting
    4. one wife keeps nagging you to stop playing on the pc and do some real work.. house chores
    5. working at 1 O'clock in the morning because nobody is awake at that time
    6. being grossly underpaid for all your hard work


Posting Permissions

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



Click Here to Expand Forum to Full Width