Read input from TextBox and assign the value to ActiveCell : TextBox « Forms « VBA / Excel / Access / Word






Read input from TextBox and assign the value to ActiveCell

 

Private Sub OKButton_Click()
    If CStr(SpinButton1.Value) = TextBox1.Text Then
        ActiveCell = SpinButton1.Value
        Unload Me
    Else
        MsgBox "Invalid entry.", vbCritical
        TextBox1.SetFocus
        TextBox1.SelStart = 0
        TextBox1.SelLength = Len(TextBox1.Text)
    End If
End Sub

 








Related examples in the same category

1.Set the selection in a TextBox
2.Copy workbook differences to the worksheet
3.Add TextBox and format it