+ Reply to Thread
Results 1 to 10 of 10

(Solve) How to add second loop in VBA coding

  1. #1
    Forum Contributor
    Join Date
    08-21-2011
    Location
    Australia, Perth
    MS-Off Ver
    Excel 2010
    Posts
    159

    (Solve) How to add second loop in VBA coding

    Hi guys,

    I have been seeking help on this forum for quite a few days now and I've received some great support from fantastic users. So before anything, thanks all of you for your help!

    Andrew developed this coding for me in a previous post and I would like to add one change:

    Please Login or Register  to view this content.
    I would like to modify one small thing in this script though: apart from everything that the script is already doing (and it's doi ng it really well), I would like the cells S4 in the three graph spreadsheets to also display the value entered in G20. At the moment, whatever is entered in S4 appears in G20 but not the other way around.

    Is this possible without any major modification? I am just worried I am not going to be able to implement the change if it's something drastic.

    Thanks for your time guys.
    Last edited by SubwAy; 11-04-2011 at 05:59 AM.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: How to add second loop in VBA coding

    Please use Code Tags not Quote tags
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    08-21-2011
    Location
    Australia, Perth
    MS-Off Ver
    Excel 2010
    Posts
    159

    Re: How to add second loop in VBA coding

    Sorry, fixed it :-)

  4. #4
    Forum Contributor
    Join Date
    08-21-2011
    Location
    Australia, Perth
    MS-Off Ver
    Excel 2010
    Posts
    159

    Re: How to add second loop in VBA coding

    Hi guys,

    I was wondering if by any chance any of you would be able to help me with this problem... I tried to understand and changing the coding myself, I wasn't really successful :-)

    Thanks for your time and help!

  5. #5
    Forum Contributor
    Join Date
    08-21-2011
    Location
    Australia, Perth
    MS-Off Ver
    Excel 2010
    Posts
    159

    Re: How to add second loop in VBA coding

    I've tried a few different combinations without success.

    Can it actually be controlled through the same macro or would it have to be something completely different?

    Thanks for your time guys

  6. #6
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: How to add second loop in VBA coding

    I don't understand what you want.
    Right now the code is doing this:

    Please Login or Register  to view this content.
    I don't understand when you say
    I would like the cells S4 in the three graph spreadsheets to also display the value entered in G20. At the moment, whatever is entered in S4 appears in G20 but not the other way around.
    I'm guessing that you want each of the Graph sheets to show 2 values:
    1) The value of an S4 that you manually entered on one of the sheets.
    2) The value of G20 on the individual Graph sheets (not the value in G20 of the DailyPlot sheet - because it just contains a copy of the S4 that you manually entered).

    Assuming that's right change the line
    Please Login or Register  to view this content.
    If that's not what you want, then you will have to give me an example of what you do want. And don't just use the Address of the cells, use the sheetname and the cell address.
    Foxguy

    Remember to mark your questions [Solved] and rate the answer(s)
    Forum Rules are Here

  7. #7
    Forum Contributor
    Join Date
    08-21-2011
    Location
    Australia, Perth
    MS-Off Ver
    Excel 2010
    Posts
    159

    Re: How to add second loop in VBA coding

    Hi foxguy,

    I have recreated a mock file with the exact same sheet names and number as my model.

    What I'd like to do is fairly simple:

    . Whatever I enter in G5 (Sheet2) from the drop down list appears in S4 on Sheet6, 7 and 9.
    . Whatever I enter in S4 (Sheet 6) from the drop down list appears in G5 (Sheet 2) and S4 in Sheet 7 and 9
    . Whatever I enter in S4 (Sheet 7) from the drop down list appears in G5 (Sheet 2) and S4 in Sheet 6 and 9
    . Whatever I enter in S4 (Sheet 9) from the drop down list appears in G5 (Sheet 2) and S4 in Sheet 6 and 7

    I hope this clarifies my previous confusing explanation.

    Thanks again for your help!
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: How to add second loop in VBA coding

    Here you go.
    I added a Range Name (Scenario) scoped to each sheet.
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    08-21-2011
    Location
    Australia, Perth
    MS-Off Ver
    Excel 2010
    Posts
    159

    Re: How to add second loop in VBA coding

    Legend, wait for it............ary!

    Thank you so much! Everything works the way it should!

  10. #10
    Forum Expert
    Join Date
    03-31-2009
    Location
    Barstow, Ca
    MS-Off Ver
    Excel 2002 & 2007
    Posts
    2,164

    Re: How to add second loop in VBA coding

    Don't forget to mark the thread "Solved".

+ 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