+ Reply to Thread
Results 1 to 5 of 5

Macro to add a line containing indirect, change sheet names in formula

  1. #1
    Registered User
    Join Date
    06-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    90

    Macro to add a line containing indirect, change sheet names in formula

    I need a macro that will add a line before the Utilities line in my Table of Contents. The new line will be a new Section line, so the formulas in the Description and Drawings columns will be the same, except the section number will change.

    So in my test workbook, I will add a Section 4 worksheet, and then I want to click a button and have a line added in between section 3 and the Utilities line on my table of contents. In the description column, the formula will be "=IF(INDIRECT("'Section 4'!$F$3") = 0, " ", INDIRECT("'Section 4'!$F$3"))",
    And the drawings column will have the same thing but F2 instead of F3.

    Thank you to anyone who can help me here!
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    06-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    90

    Re: Macro to add a line containing indirect, change sheet names in formula

    Can anyone point me in the right direction?

  3. #3
    Registered User
    Join Date
    06-05-2013
    Location
    United States
    MS-Off Ver
    Excel 2013
    Posts
    90

    Re: Macro to add a line containing indirect, change sheet names in formula

    Please Login or Register  to view this content.
    I edited some code I found to attempt it, but it's not great. Instead of referencing activecell.row, I want to insert the row before the Utilities line. I could always just set the active selection to the cell containing the string "Utilities" but I'm sure there's a better solution. This Macro copies the formula from the previous section, right? I need it to add 1 to the section # in the formulas, so probably using an i = i+1 kinda deal?

  4. #4
    Registered User
    Join Date
    07-15-2013
    Location
    Atkinson, Nebraska
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Macro to add a line containing indirect, change sheet names in formula

    Why don't you just record the insert macro first, clean it up, and then post that? And then someone (not me, I can't write the stuff) can help you write the formula change macro. You've been posting a lot of these, so I figure that these are all going to be kind of connected, right? Well you can always just record a lot of micro-macros (hehe ) and then right a macro to call all of them at once.

  5. #5
    Registered User
    Join Date
    07-15-2013
    Location
    Atkinson, Nebraska
    MS-Off Ver
    Excel 2013
    Posts
    10

    Re: Macro to add a line containing indirect, change sheet names in formula

    Oh. That doesn't work, now does it? You can try, but your 'Utilities' line will be changing so you need a reference based on those contents. I have a thread posted trying to get an answer for that, hopefully one of us can get an answer for you.

+ 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. Sum of indirect sheet names with multiple cells (SUM, INDIRECT,SHEETNAME in cell)
    By a1b2c3d4e5f6g7h8 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-12-2013, 08:42 AM
  2. Replies: 3
    Last Post: 03-07-2011, 03:18 AM
  3. INDIRECT lookup of sheet names
    By Jenny in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-14-2006, 12:35 AM
  4. INDIRECT sheet Names
    By Pester in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-09-2006, 03:00 PM
  5. [SOLVED] Help with an Indirect formula to reference sheet names
    By PCLIVE in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-04-2005, 01:05 PM

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