I was reading a post by another where the need for a Global declaration wasn't needed.
I have a Sub asking for the user to enter a value, in another Sub I use the entered value to Call other Subs based on their input.
Am I close in my example? Thank you
Option Explicit
Sub MonthTest()
Dim strMonth As String
strMonth = InputBox("enter Area here")
Call Test2
End Sub
Sub Test2(strMonth As String)
Select Case strMonth
Case Is = "82"
Call Area82
Case Is = "80"
Call Area80
End Select
End Sub
Replace 'Call Test2with
Test2 strMonth, there's no need to use
Call`
Variable declared in a sub/function stays in the sub/function itself only, since you have declare a parameter in Test2
, you will need to provide the parameter everytime you call Test2 (unless its declare as Optional
).