Results 1 to 2 of 2

Thread: Need help understand Excel Macro

  1. #1

    Need help understand Excel Macro



    Register for a FREE account, and/
    or Log in to avoid these ads!

    I need help in understanding what this macro does...

    Code:
    Sub DoGoalSeek()'
    ' DoGoalSeek Macro
    ' Macro recorded 19/04/2011 by glittle
    '
    
    
    '
        Range("B4").Select
        ActiveCell.FormulaR1C1 = "5"
        ActiveSheet.Calculate
        Range("E30").Select
        Range("E30").GoalSeek Goal:=0, ChangingCell:=Range("B4")
    End Sub
    I am novice to this. Please help me

  2. #2
    Administrator Ken Puls's Avatar
    Join Date
    Mar 2011
    Location
    Nanaimo, BC, Canada
    Posts
    2,087
    Articles
    79
    Blog Entries
    14
    It:
    • It puts a 5 in cell B4
    • It recalculates the worksheet
    • It changes E30 to 0 by changing the value in B4
    Based on what I can see here, I'd assume that E30 has a formula that uses B4 as an input. Why it puts a 5 in the cell is beyond me, though, as the value will just get overwritten when the goalseek is triggered.

    Hope that helps,
    Ken Puls, FCPA, FCMA, MS MVP (Excel)

    Master your data with Power Query: Purchase your copy of my book M is for Data Monkey today!

    Main Site: http://www.excelguru.ca -||- Blog: http://www.excelguru.ca/blog -||- Forums: http://www.excelguru.ca/forums
    Check out the Excelguru Facebook Fan Page -||- Follow Me on Twitter

    If you've been given VBA code (a macro) for your solution, but don't know where to put it, CLICK HERE.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •