Run macro when data validation list changed

becken

New Member
Joined
Mar 13, 2006
Messages
24
I know there are loads of posts re. this as I've read most of them, but the code I have just doesn't work. Would someone be kind enough to have a look at it and tell me why please.

All I want to do is run my Goalseek macro once the contents from a data validation list is changed. It works when the non-drop down list boxes are changed.

The code is in the sheet code and has worksheet and change selected from drop-down menus at the top, and goalseek macro is in module 1, as the calculations are done on a separate sheet to the values changing. Thanks for any help.

Alan

Code:
Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Not Intersect(Target, Range("b1:b13")) Is Nothing Or Target.Cells.Count > 1 Then
Module1.Goalseek
End If
Application.EnableEvents = True
End Sub
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
No there's no error. It just doesn't update the calculation I have in cell b34 which is the result of the Goalseek macro running on a different sheet.
 
Upvote 0
do you want to post your code?I have done a msgbox for the GoalSeek and it works.
 
Upvote 0
I'm happy that the goalseek calculates an answer because it all works when I manually enter a value into other cells but it doesn't run when I change a drop down list. My code is below. Hope you can (and many thanks if you can :) ) find my problem!

Code:
Sub Goalseek()

Application.ScreenUpdating = False

Sheets("Calcs1").Select
  Range("L30").Select
  Range("L30").Goalseek Goal:=Range("B28"), ChangingCell:=Range("J32")
  Sheets("Front page").Select

Application.ScreenUpdating = True

End Sub
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,207
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top