Hey all....need some help trying to build a simple "egg timer". (Don't ask why) I thought this would be super simple and I was basically on my way until I hit a little snag. The basic idea is as follows:

I set up an embedded command button right on the worksheet to launch a bit of vba code.

The code launches a simple form that uses a spin button connected with a text box. You can click the spin button and select a number between 1 and 120 that should be displayed in the text box.

As far as I know, I am pretty good up until this point. Problem is that I want to take the value that is entered into the text box via the spinner button and launch a form that says something like "Time is up" at a time that is x minutes in the future, where x is the number dialed in by the spinner box. Problem I am having is that I don't know how to use the onTime function with variables....

here is a copy of my bogus code associated with the user form described above: (known problem area in bold at the OKButton section)

Private Sub SpinButton1_Change()
    'update the textbox value to the spinbox if the spinbox changes
    TextBox1.Text = SpinButton1.Value
End Sub
Private Sub TextBox1_Change()
    'update the spinbutton value to the textbox if the textbox changes to a number within the proper range
    Dim NewVal As Integer
    
    NewVal = Val(TextBox1.Text)
    If NewVal >= SpinButton1.Min And _
        NewVal <= SpinButton1.Max Then _
        SpinButton1.Value = NewVal
End Sub
Private Sub UserForm_Initialize()
 With SpinButton1
'       When form fires up, initialze all the controls
'       Specify upper and lower limits
        .Min = 1
        .Max = 120
'       Change label
'       Initialize Spinner
        .Value = 1
'       Initialize TextBox
        TextBox1.Text = .Value
    End With
End Sub

Private Sub TextBox1_Enter()
'   Selects all text when user enters TextBox
    TextBox1.SelStart = 0
    TextBox1.SelLength = Len(TextBox1.Text)
End Sub

Private Sub OKButton_Click()
     Dim TimeInterval As String
     TimeInterval = CStr(SpinButton1.Value)
     Application.OnTime Now + TimeValue("00:00:" & TimeInterval), "DisplayAlarm"
End Sub

Private Sub DisplayAlarm()
     MsgBox "Time Expired"
End Sub
Thanks for the help.
m.hatter