Message 1 of 6
Public Variable Accessed by Function?
Not applicable
08-21-2007
02:25 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
'I have a public variable:
Public RefZone1Rng As Range
'That I set in a Sub:
Sub CheckZones()
Set RefZone1Rng = Refwrksht.Range(Refwrksht.Cells(2, 1), Refwrksht.Cells(RefZone1_Bot, 1))
'That I would like to be available to a Function that I pass some variables to within the first sub:
ColorNum = Search_ref_zone(Choice, BZone)
End Sub
'The following is the function that I go to. I would like it to recognize that RefZone1Rng has been declaired in the procedure above without having to pass it the variables explicitely.
Function Search_ref_zone(RefZone As Integer, BZone As String)
Dim SelRange As Range
Select Case RefZone
Case 1
SelRange = RefZone1Rng
End Select
End Function
'Is this possible? Thank you!
Public RefZone1Rng As Range
'That I set in a Sub:
Sub CheckZones()
Set RefZone1Rng = Refwrksht.Range(Refwrksht.Cells(2, 1), Refwrksht.Cells(RefZone1_Bot, 1))
'That I would like to be available to a Function that I pass some variables to within the first sub:
ColorNum = Search_ref_zone(Choice, BZone)
End Sub
'The following is the function that I go to. I would like it to recognize that RefZone1Rng has been declaired in the procedure above without having to pass it the variables explicitely.
Function Search_ref_zone(RefZone As Integer, BZone As String)
Dim SelRange As Range
Select Case RefZone
Case 1
SelRange = RefZone1Rng
End Select
End Function
'Is this possible? Thank you!