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
 

Some videos you may like

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Babak

New Member
Joined
Sep 8, 2002
Messages
25
Instead of as (Byval Cur as Char) in UpdateData write
(Byval Cur as String)
 

cecile

New Member
Joined
Oct 23, 2002
Messages
10
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
 

Babak

New Member
Joined
Sep 8, 2002
Messages
25
I forgot to tell you to replace 'USD' with "USD" when you call the sub
 

Babak

New Member
Joined
Sep 8, 2002
Messages
25

ADVERTISEMENT

By the way my name is Babak! :)
 
L

Legacy 98055

Guest
Note the syntax when assigning or using the call statement.

UpdateData USD

Call UpdateData(USD)

MyVariable = UpdateData(USD)

Tom
 

cecile

New Member
Joined
Oct 23, 2002
Messages
10

ADVERTISEMENT

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
 

Babak

New Member
Joined
Sep 8, 2002
Messages
25
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
 

Babak

New Member
Joined
Sep 8, 2002
Messages
25
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
 

cecile

New Member
Joined
Oct 23, 2002
Messages
10
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
 

Watch MrExcel Video

Forum statistics

Threads
1,122,577
Messages
5,596,996
Members
414,116
Latest member
sfullnet

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
Top