ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Calling Macro when using Select Case (https://www.excelbanter.com/excel-programming/315267-calling-macro-when-using-select-case.html)

helmekki[_49_]

Calling Macro when using Select Case
 

Hi :confused: :confused: :confused:

In the code below i am tring to call another macro (ShowTotal) which i
located in the same WB and the other macro (SendD) is located in
different WB...

but no response........i mean the macros that tring to call them do no
response
and the rest of the Test macro works fine

Any idea why cannot call macro from this macro in particular...
might be select case procedure hinder calling macros...or somethin
ealse......???


PHP code
-------------------
Sub test()
Dim R As String
R = Sheet2.Range("C77")

Select Case R
Case "Ali"
Call ShowTotal
MsgBox "OK"

Case "Sami"
Call SendD
MsgBox "OK"
End Select
End Su
-------------------


Thank

--
helmekk

-----------------------------------------------------------------------
helmekki's Profile: http://www.excelforum.com/member.php...nfo&userid=693
View this thread: http://www.excelforum.com/showthread.php?threadid=27375


John Green[_4_]

Calling Macro when using Select Case
 
The call to the macro in the same workbook should be OK, as long as the
called macro is in a standard module (not a class module or a module behind
a worksheet or userform).

If it does not execute, you might be failing the test, which is case
sensitive. That is, "ali" in your worksheet will not match "Ali" in your
Case statement.

To call a macro in another workbook, you must create a reference to the
other workbook in the VB Editor using Tools|References - or you can use a
construction like the following:

Application.Run "Book2.xls!SendD"

--
John Green
Sydney
Australia


"helmekki" wrote in message
...

Hi :confused: :confused: :confused:

In the code below i am tring to call another macro (ShowTotal) which is
located in the same WB and the other macro (SendD) is located in a
different WB...

but no response........i mean the macros that tring to call them do not
response
and the rest of the Test macro works fine

Any idea why cannot call macro from this macro in particular...
might be select case procedure hinder calling macros...or something
ealse......???


Formula:
--------------------
Sub test()
Dim R As String
R = Sheet2.Range("C77")

Select Case R
Case "Ali"
Call ShowTotal
MsgBox "OK"

Case "Sami"
Call SendD
MsgBox "OK"
End Select
End Sub
--------------------


Thank u


--
helmekki


------------------------------------------------------------------------
helmekki's Profile:

http://www.excelforum.com/member.php...fo&userid=6939
View this thread: http://www.excelforum.com/showthread...hreadid=273752





All times are GMT +1. The time now is 08:13 AM.

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