+ Reply to Thread
Results 1 to 9 of 9

Targeting Worksheet Name by Cell Value

  1. #1
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Targeting Worksheet Name by Cell Value

    I have some a column of numbers "A" and I have tabs that are named after them.

    How do I add each sheets A1 total to the current value of Column B?

    It seemed simple, but I just can't debug this at all; I'm getting a subscript out of range error when trying to target Sheets(c).Range("A1"). c.Value didn't work either.


    Please Login or Register  to view this content.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Targeting Worksheet Name by Cell Value

    Hello daffodil1,

    You are receiving the error message because you don't have 10 sheets in the workbook.
    Can you post before and after examples or even the workbook?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Targeting Worksheet Name by Cell Value

    My actual range and offset are a little different.

    I'm mostly interested in how to take the offset of each value in a range, and add to it the value from a sheet named after each cell in the starting range.

    (And without the use of regular circular referencing formulas.)



    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Targeting Worksheet Name by Cell Value

    Hello daffodil11,

    You can use this formula and drag it down...
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Targeting Worksheet Name by Cell Value

    This is for the updating of a form, which can't have a circular reference or a helper column.

    I'm specifically looking for a VB solution to update a column of totals in K, where the values of A are the Sheet Names. Would you recommend I remove the For and simply target each with their own code block?

    If Range("A1") <> "" Then Range("K1").Value = Range("K1") + Sheets(Range("A1").Value).Range("A1")
    If Range("A2") <> "" Then Range("K2").Value = Range("K2") + Sheets(Range("A2").Value).Range("A1")
    If Range("A3") <> "" Then Range("K3").Value = Range("K3") + Sheets(Range("A3").Value).Range("A1")
    ETC
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Targeting Worksheet Name by Cell Value

    Hello daffodil11,,

    Sorry for the delay, I got a couple of phone calls. To do this VBA...
    Please Login or Register  to view this content.

  7. #7
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Targeting Worksheet Name by Cell Value

    So awesome. I've been working on a variation of this for our forecasting updates.

    Much appreciated.

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Targeting Worksheet Name by Cell Value

    Hello daffodil11,

    'S e do bheatha. (You're welcome)

  9. #9
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Targeting Worksheet Name by Cell Value

    Gesundheit!

+ 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. Options targeting a specified total
    By santitobibenji in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-29-2014, 11:39 PM
  2. Replies: 1
    Last Post: 12-28-2013, 11:46 PM
  3. Targeting Multiple Workbooks using a Range to target by workbook an/or worksheet
    By daffodil11 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-18-2013, 04:02 PM
  4. targeting another prg by using DDE in the code
    By CC_rider in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-21-2006, 02:45 PM
  5. Problems targeting any version of Excel
    By Larry Lard in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-19-2005, 08:06 AM

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