ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can I automate the launch of a macro using the result of a formula (https://www.excelbanter.com/excel-programming/410300-can-i-automate-launch-macro-using-result-formula.html)

Charlie Betz

Can I automate the launch of a macro using the result of a formula
 
I have developed a game in Excel. Successful completion causes a formula to
return 'True'. I want this result to launch a macro. As background the macro
will transport the player to another sheet.

Any advice will be very much appreciated

[email protected]

Can I automate the launch of a macro using the result of aformula
 
Hi
Use the worksheet_change event

Private Sub Worksheet_Change(ByVal Target As Range)
Set MyCell = Range("A1") 'your formula in A1
If not intersect (Target, MyCell) is nothing then 'ignore unless
MyCell changes
If MyCell.Value = 2 then 'value from formula
call myMacro
End if
End if

End Sub

You find this event when you double click the sheet name in the visual
basic editor and choose Worksheet from the dropdown.
regards
Paul

On May 1, 11:30*am, Charlie Betz <Charlie
wrote:
I have developed a *game in Excel. Successful completion causes a formula to
return 'True'. I want this result to launch a macro. As background the macro
will transport the player to another sheet.

Any advice will be very much appreciated



Don Guillett

Can I automate the launch of a macro using the result of a formula
 
Right click sheet tabview codepaste this. Now if you change cell e1 to 2
you goto sheet 9

Private Sub Worksheet_Change(ByVal Target As Range)
'correct word wrap if necessary
If Target.Address = "$E$1" And Target = 2 Then Sheets("sheet9").Select

End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Charlie Betz" <Charlie
wrote in message
...
I have developed a game in Excel. Successful completion causes a formula
to
return 'True'. I want this result to launch a macro. As background the
macro
will transport the player to another sheet.

Any advice will be very much appreciated




All times are GMT +1. The time now is 09:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com