+ Reply to Thread
Results 1 to 4 of 4

VBA/Macro Build for sending data to different sheets

  1. #1
    Registered User
    Join Date
    07-21-2011
    Location
    Baton Rouge, Louisiana
    MS-Off Ver
    Excel 2007
    Posts
    19

    Exclamation VBA/Macro Build for sending data to different sheets

    Hi,

    I have no experience with using VBA or building macros....

    Attached, I have 2 sheets. On the first sheet, I have labled "Opex" where I input all of my data. On the 2nd sheet, I have a sheet that I want specific information sent to in that format. The problem is that the Opex sheet is not set up in the format.

    So I need a macro that can take the information from the "cc","ce","Ce description", "Jan through Dec", and the "2012 Approved Budget" to go into the "data" tab and match it up with each column. What does the code look like for that?

    If there's another solution besides a macro, I'm definitely open to suggestions.

    Thanks,
    Paul
    Attached Files Attached Files

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: VBA/Macro Build for sending data to different sheets

    Paul,

    Looks like all you need is an Index/Match formula. Given your sample workbook, in the Data Upload sheet, cell A2, input the following formula:
    =INDEX(Opex!9:9,,MATCH(A$1,Opex!$8:$8,0))

    Then copy over through Dec
    Then copy down as needed (I copied down for 300 rows)

    NOTE: You'll have to make sure the Data Upload column headers match the Opex column headers exactly. I had to change Jul to July and Sep to Sept.

    I found that the Opex sheet had lots of formatting, but the Data Upload sheet was all in "General" format so I'm not sure what you mean by its already formatted like you want it...? And in the Total column, I'm guessing you just want a sum from D:O (the month columns).

    Hope that helps,
    ~tigeravatar

  3. #3
    Registered User
    Join Date
    07-21-2011
    Location
    Baton Rouge, Louisiana
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: VBA/Macro Build for sending data to different sheets

    Thanks for the response,

    I did use the Index/Match function as a last resort actually...and that will probably have to do for now.

    I basically just wanted to have a macro built to have the data taken as is from the OPEX sheet and automatically placed in the arranged columns in the Data Upload sheet at the press of a button. I orginally tried to record a macro, but I got all the formulas instead of the values. What should my next step be if I were to persue a macro?

    Thanks,
    Paul

  4. #4
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: VBA/Macro Build for sending data to different sheets

    Paul,

    Since you're specifically looking for a macro solution over a formula solution, the following should be what you're looking for:
    Please Login or Register  to view this content.

    EDIT: Updated macro to perform correctly. As with the formula solution, I had to update the Jul and Sep headers in the 'Data Upload' sheet to July and Sept so that they would match correctly.

    Hope that helps,
    ~tigeravatar
    Last edited by tigeravatar; 08-08-2011 at 04:07 PM. Reason: Updated macro, added notes

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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