2

I am facing one small problem please help me.

sub vari()
dim b as integer
dim c as integer
b=6
c=8
end sub

now i want to use b and c in another function .

sub calculate()
dim a as integer
a = c+b
end sub

I am getting error here

2

1 Answer 1

8

You want to use the proper scope for your variables. If you want for b and c to be accessible to both vari() and calculate() you need to declare them globally, like so:

Public b As Integer
Public c As Integer
sub vari()
....
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.