Need help understand Excel Macro

sohaibshaheen

New member
Joined
Nov 13, 2011
Messages
1
Reaction score
0
Points
0
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
 

Ken Puls

Administrator
Staff member
Joined
Mar 13, 2011
Messages
2,521
Reaction score
6
Points
38
Location
Nanaimo, BC, Canada
Website
www.excelguru.ca
Excel Version(s)
Excel Office 365 Insider
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,
 
Top