ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA code: call subprocedure (https://www.excelbanter.com/excel-programming/348051-vba-code-call-subprocedure.html)

Terry

VBA code: call subprocedure
 
Hi,
I am writing a VBA program。The program structure listed below:

Private Sub b(i As Integer, j As Integer)
......
End Sub

Sub a()
....
b (i, j)
...
End Sub

It appeard error message while I call subprocedure b in main-procedure a.
Error message :
Compile error
Miss :=

Would you tell me how to write the code in order to call the subprocedure b?
Thanks a lot!



bpeltzer

VBA code: call subprocedure
 
Put the word call in front of the procedure call: call b(i,j). Not entirely
sure why, but the help suggests: "a function call can't stand by itself, and
Sub procedure calls sometimes require the Call keyword, depending on how you
specify their arguments."


"Terry" wrote:

Hi,
I am writing a VBA program隆拢The program structure listed below拢潞

Private Sub b(i As Integer, j As Integer)
......
End Sub

Sub a()
....
b (i, j)
...
End Sub

It appeard error message while I call subprocedure b in main-procedure a.
Error message :
Compile error
Miss :=

Would you tell me how to write the code in order to call the subprocedure b?
Thanks a lot!




Leith Ross[_379_]

VBA code: call subprocedure
 

Hello Terry,

When calling a Sub procedure with parentheses like b(i, j), you mus
precede the cal with the keyword Call...

Call b(i,j)

Sincerely,
Leith Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=49325


Leith Ross[_380_]

VBA code: call subprocedure
 

Hello Terry,

When calling a Sub procedure with parentheses like b(i, j), you must
precede the cal with the keyword Call...

Call b(i,j)

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=493258


Terry

VBA code: call subprocedure
 
Thank you very much!
"bpeltzer" ...
Put the word call in front of the procedure call: call b(i,j). Not
entirely
sure why, but the help suggests: "a function call can't stand by itself,
and
Sub procedure calls sometimes require the Call keyword, depending on how
you
specify their arguments."


"Terry" wrote:

Hi,
I am writing a VBA program?£The program structure listed below£o

Private Sub b(i As Integer, j As Integer)
......
End Sub

Sub a()
....
b (i, j)
...
End Sub

It appeard error message while I call subprocedure b in main-procedure a.
Error message :
Compile error
Miss :=

Would you tell me how to write the code in order to call the subprocedure
b?
Thanks a lot!






Terry

VBA code: call subprocedure
 
Thank you very much!
"Leith Ross" 写入消息新闻:Leith.Ross.200cem_1134526395.78@excel forum-nospam.com...

Hello Terry,

When calling a Sub procedure with parentheses like b(i, j), you must
precede the cal with the keyword Call...

Call b(i,j)

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile:
http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=493258





All times are GMT +1. The time now is 05:10 PM.

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