+ Reply to Thread
Results 1 to 3 of 3

Goal Seek Macro - to repeat every

  1. #1
    Registered User
    Join Date
    03-17-2011
    Location
    Rhode Island
    MS-Off Ver
    Excel 2010
    Posts
    3

    Question Goal Seek Macro - to repeat every

    I'm getting better at Macro's but I'm stumped and need some expert help.

    I have a document created by someone else that I'm trying to modify. There are three steps, the 1st and 2nd I can do manually but would love a macro to do it automatically.

    First step - Cell F51 is a formula but needs to be changed to a value - 20, but it is not the full column. The next step is F99, then F147 all the way to F37347.

    Next step - I need to make all values in rows G:K = the cell in F, but only on the rows that were just changed to the number 20 (rows 51, 99, 147, up to 37347).

    Once that is done I need to goal seek the value in cell O53 to match the value in P53 by changing the value in F51 that I just changed to 20, so it will now change again (20 is just an arbitrary number that is close to the result that I often see in column O.

    Since this is a huge spreadsheet with a lot of data I don't want to sort it, I'm afraid it won't get back to where it was, and it will take way too long to do manually. I can filter it - fortunately the creater turned the cells that I need to change in column F red - not sure if that helps or not...

    Any help you can give will save me LOTS of time.

  2. #2
    Registered User
    Join Date
    03-17-2011
    Location
    Rhode Island
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Goal Seek Macro - to repeat every

    I can manually do most of this - if anyone can help with the part copied below I'll be all set. Thanks in advance for your help.

    I need to goal seek the value in cell O53 to match the value in P53 by changing the value in F51. I can do a macro for this - but what I can't figure out is how to have the macro repeat until the end row 37347 every 48 rows, skipping every row in between. My really simple basic macro is copied below but it isn't much. I tried to make it a loop, but I'm not sure how to make it jump 48 rows down, repeat, jump 48 rows down, repeat etc.

    Sub GOALSEEK()
    Range("O5477").GOALSEEK Goal:=Range("P5477"), ChangingCell:=Range("F5475")
    End Sub

  3. #3
    Registered User
    Join Date
    03-17-2011
    Location
    Rhode Island
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Goal Seek Macro - to repeat every

    I'm getting closer. I just need to figure out one last piece of the puzzle. I created the loop and it works, but what is wrong is my initial macro - it only looks at one set of cells instead of every cell in column O, P, and F. Here is what I have:

    Sub Test2()

    Range("O53").Select

    Do Until IsEmpty(ActiveCell) And IsEmpty(ActiveCell.Offset(51, 0))
    Range("O53").GOALSEEK Goal:=Range("P53"), ChangingCell:=Range("F51")
    ActiveCell.Offset(48, 0).Select
    Loop
    End Sub

    But this only works on the specified cells - but I'm not sure how to change it so that it changes the cell in O to match the cell in P by changing the cell in F that is two rows above.

+ 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