simple macro ?

cecile

New Member
Joined
Oct 23, 2002
Messages
10
Hi All:

I am trying to call a routine within a routine in VBA

I am writing:
Sub UpdateData_USD

UpdateData('USD');

EndSub

Sub UpdateData(BYval Cur as char)
.....
EndSub

Gave me an error message.

Could someone help me finding the right syntaxe?

Thanks
Cheers
Cecile
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Hi Bakac:

Thanks for the answer. However my Subroutine updatedata_USD_B still does not work because when

Sub updatedata_USD_B()

updatedata('USD');

End Sub

ir is giving me a syntax error on the line "updatedata('USD');"

Cheers
cecile
 
Upvote 0
Note the syntax when assigning or using the call statement.

UpdateData USD

Call UpdateData(USD)

MyVariable = UpdateData(USD)

Tom
 
Upvote 0
Hi Babak:
Thanks for the advice. I modified my code but keep geting a 'Synatx Error". Apparently VB still does not like:

Sub UpdateData_USD_B()

UpdateData("USD");

EndSub

Cheers
cecile
 
Upvote 0
Tom syntaxes are right. the last one is for functions
Are you a Pascal or C programmer?
If you delete ; at the end of your call and your code will work.
Good luck
 
Upvote 0
Tom's syntaxes are right. the last one is for functions
Are you a Pascal or C programmer?
If you delete ; at the end of your call and your code will work.
Good luck
 
Upvote 0
Thanks all of you guys.Babak and TsTom...It works..I am a VFP/C/C++ programmer and only a beginner in VB!.
Cheers
Cecile
 
Upvote 0

Forum statistics

Threads
1,214,830
Messages
6,121,835
Members
449,051
Latest member
excelquestion515

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