+ Reply to Thread
Results 1 to 5 of 5

Creating a complicated macro

  1. #1
    Registered User
    Join Date
    06-18-2007
    Posts
    14

    Unhappy Creating a complicated macro

    I'm trying to develop a macro that does the following:
    1) Copies a hidden tab named Template to the workbook
    2) Goes back to the Main tab
    3) Inserts a line on this main tab
    4) Adds a formula that is =+IF('Template (xx)'!$E$14="", "", 'Template (xx)'!$E$14) to cell C9 also on the "Main" tab
    Note: xx is the template tab number (ie; Template (2))

    And then every time this macro is run, it has to keep changing the xx value within the formula to the new template tab name (ie; Template (3), Template (4), etc).

    I've tried doing it in different ways but I just can't seem to have the macro add in between the parathesis every time it gets run.

    I know it must be hard to understand as I might not have made myself clear, but let me know and I'll try harder...

    But either way, thanks for looking at this post and trying to help...

    Nacho

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Nacho

    See if this gets you started.

    Please Login or Register  to view this content.
    Not sure about (3). Do you want to insert a new row at row 9 and insert this formula or are you replacing any existing C9 formula on Main...


    rylo

  3. #3
    Registered User
    Join Date
    06-18-2007
    Posts
    14

    Smile

    Rylo,

    That is actually what I was looking for, however I tried to re-run so that it copied the tab again and inserted another row but it didn't work. It created a new template (Template (3)) but it didn't insert another row with the formula.

    Also, if I were to create more columns that had different formulas, how would I add them into the macro?

    Again, thank you so much for your great help...

    Nacho

  4. #4
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591
    Nacho

    I wasn't sure about the new row. Can you confirm that for every new copy of the template, you want to insert a new row 9 on sheet Main, and create a formula in the new C9 that points to the new sheet.

    To add more formulas, insert new rows in the macro and have it add the formulas in the same way that the current formula is created. If you can give some more examples, I'll code a couple more so you can get the idea.


    rylo

  5. #5
    Registered User
    Join Date
    06-18-2007
    Posts
    14

    Talking Thanks a lot!!

    With the information you gave me on the post before gave me somewhat of an idea of what I had to do. After playing around for a while I finally got it to work. Thanks a lot!!!!

+ 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