jwise
12-17-2008, 01:10 PM
I'm using an initialize routine to set Public variables. When my Spin Up/Down code is executed, the initialized variables are not there. I assume I am leaving out something. Any ideas?
Here is some sample code:
Public maxSourceRow as Long
Private Sub SpbSource_SpinUp()
Dim wsIn As Worksheet
With Me.spbSource
If .Value > maxSourceRow - 1 Then
.Value = maxSourceRow - 1
End If
Me.lblRowS.Caption = .Value
End With
End Sub [
Public maxSourceRow as Long
Sub frmInit()
...
maxSourceRow = LastRowWithData(wsSource)
...
The program was traced and LastRowWithData is returning the correct number of rows. When the "spin up" arrow is pressed, the error is received indicating there is no value for maxSourceRow.
The Spin routines are located in the "userform" code area, and frmInit is in "Module1".
TIA
Here is some sample code:
Public maxSourceRow as Long
Private Sub SpbSource_SpinUp()
Dim wsIn As Worksheet
With Me.spbSource
If .Value > maxSourceRow - 1 Then
.Value = maxSourceRow - 1
End If
Me.lblRowS.Caption = .Value
End With
End Sub [
Public maxSourceRow as Long
Sub frmInit()
...
maxSourceRow = LastRowWithData(wsSource)
...
The program was traced and LastRowWithData is returning the correct number of rows. When the "spin up" arrow is pressed, the error is received indicating there is no value for maxSourceRow.
The Spin routines are located in the "userform" code area, and frmInit is in "Module1".
TIA