call model doesn't work

afasseeh

New Member
Joined
Jul 1, 2014
Messages
13
windows 8.0
office 2013
samsung ativ 500t

the macro (Yes_Utility_Decrement) works fine when called from any other Sub either private or not. but in that particular piece of code it does not work.

Private Sub Worksheet_Change(ByVal Target As Range)


'apply utility decrement upon changing value
If Target.Address = "$D$40" Then
If Range("D40") = Range("E39") Then

Yes_Utility_Decrement
Else: If Range("D40") = Range("E40") _
Then No_Utility_Decrement
End If
End If

'apply currency upon changing value
If Target.Address = "$D$35" Then
Call Currency_Change
End If


'apply DSA max and min upon changing value
If Target.Address = "$D$30" Or Target.Address = "$D$31" Then
Call DSAMaxMin
End If

End sub

this piece of code doesn't work although when I insert a msgbox"Hi" after then it displays the message box..
Also
'apply currency upon changing value
and 'apply DSA max and min upon changing value works fine.


this code below works
Sub test()
Dim x As Double
x = 1
If x = "1" Then
If x = "1" Then
Yes_Utility_Decrement
End If
End If




End Sub
as well as the same using
No_Utility_Decrement

I tried using
Call Yes_Utility_Decrement
Run ("Yes_Utility_Decrement")

still did not work
 
Private Sub Worksheet_Change(ByVal Target As Range)


Call Currency_Change
Call Yes_Utility_Decrement


'apply utility decrement upon changing value
ThisWorkbook.Sheets("Settings").Activate
If Target.Address = "$D$40" Then
If Range("D40") = Range("E39") Then
MsgBox "Yes"
Call Yes_Utility_Decrement


Else: If Range("D40") = Range("E40") Then Call No_Utility_Decrement
MsgBox "No"
End If



End If



'apply currency upon changing value
If Target.Address = "$D$35" Then
Call Currency_Change
End If


'apply DSA max and min upon changing value
If Target.Address = "$D$30" Or Target.Address = "$D$31" Then
Call DSAMaxMin
End If



End Sub

Call Currency_Change worked completely fine
Call Yes_Utility_Decrement did not do anything


 
Upvote 0

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
What do you mean by "did not do anything"? Have you tried putting a break point in the procedure and stepping through it?
 
Upvote 0
Did you put a breakpoint in the Yes_Utility_Decrement procedure?
when i put a breakpoint in Yes_Utility_Decrement procedure, and then run

Private Sub Worksheet_Change(ByVal Target As Range)

Call Yes_Utility_Decrement
End Sub

it doesn't break. ie. it doesnt go through the Yes_Utility_Decrement procedure

 
Upvote 0
Do you want to put your workbook on a share like Box.com and post the URL so that I can take a look at it?
THANK you soo much I really appreciate your help. I know you are doing your best to help and spent alot of time.
actually I would like to but my company policy does not allow this ever.
thank you again I really appreciate you help. I will try find other ways to approach the same issue or pass it to my seniors and they may have a solution.
whenever I have a solution I will share it.
Best Regards,
 
Upvote 0
Do you want to put your workbook on a share like Box.com and post the URL so that I can take a look at it?
I FOUND THE ERROR.
it was quite easy that I couldnt see it.
the macro was actually working and called.
the problem is in the location it is running, I had to add
ThisWorkbook.Sheets("needed worsheet").Activate
at the begining and thats it.
thanks for your help and sorry for wasting your time.
 
Upvote 0

Forum statistics

Threads
1,215,336
Messages
6,124,332
Members
449,155
Latest member
ravioli44

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