Dim startVal As String
Dim noSpace As String
startVal = TextBox1.Value
noSpace = Replace(startVal, " ", "")
If Len(startVal) = Len(noSpace) Then
MsgBox "Need to have at least one space"
ElseIf Len(noSpace) = 0 Then
MsgBox "Need to have some text"
Else
MsgBox "Good to go"
'Proceed with code
End If
Sub onlySpace()
Dim i, y As Integer
Dim x
y = 0
x = Split(ActiveSheet.Range("A2"), " ")
If UBound(x) = Len(ActiveSheet.Range("A2")) Or Len(ActiveSheet.Range("A2")) = 0 Then
MsgBox "Need Text"
Else
MsgBox "Good To Go" 'Your code here
For i = LBound(x) To UBound(x) - 1
y = y + Len(x(i)) + 1
x(i) = y
Next i
End If
End Sub
Private Sub cmdSalvar_Click()
Dim ws As Worksheet
Set ws = Worksheets("BD_Ava")
'NEW CHECK
If Len(Replace(txtObs.Value, " ", "")) = 0 Then
MsgBox "Must fill in some text"
Exit Sub
End If
'continue with rest of code
'...
Private Sub txtObs_Exit(ByVal Cancel As MSForms.ReturnBoolean)
Dim i, y As Integer
Dim x
y = 0
x = Split(Activesheet.Range("A2"), " ")
If UBound(x) = Len(txtObs.Text) Or Len(txtObs.Text) = 0 Then
MsgBox "Need Text"
Else
MsgBox "Good To Go" 'Your code here
For i = LBound(x) To UBound(x) - 1
y = y + Len(x(i)) + 1
x(i) = y
Next i
End If
ContadorTextBox
frmCadAva.Repaint
End Sub
Private Sub txtObs_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = vbKeySpace Then
KeyAscii = 0
End If
End Sub