dukeofscouts
Board Regular
- Joined
- Jan 19, 2009
- Messages
- 146
I'm trying to work on some VBA code that will allow me to type a text string, which excel will then "read" and perform a series of actions based on the characters in that text string. Below is what I tried, but I got an error message. My guess is I need to set the "i" value differently, any suggestions?
-Thanks much
--D.O.S.
Private Sub CommandButton2_Click()
For Each i In Rubrixform.TextBox1.Value
If Mid(Rubrixform.TextBox1.Value, i, 1) = "f" Then
If Mid(Rubrixform.TextBox1.Value, i+1, 1) = "'" Then
RubixFi
Else
RubixF
If Mid(Rubrixform.TextBox1.Value, i, 1) = "r" Then
If Mid(Rubrixform.TextBox1.Value, i+1, 1) = "'" Then
Rubixri
Else
Rubixr
If Mid(Rubrixform.TextBox1.Value, i, 1) = "u" Then
If Mid(Rubrixform.TextBox1.Value, i+1, 1) = "'" Then
RubixUi
Else
RubixU
If Mid(Rubrixform.TextBox1.Value, i, 1) = "d" Then
If Mid(Rubrixform.TextBox1.Value, i+1, 1) = "'" Then
Rubixdi
Else
Rubixd
If Mid(Rubrixform.TextBox1.Value, i, 1) = "l" Then
If Mid(Rubrixform.TextBox1.Value, i+1, 1) = "'" Then
Rubixli
Else
Rubixl
Next i
End Sub
-Thanks much
--D.O.S.
Private Sub CommandButton2_Click()
For Each i In Rubrixform.TextBox1.Value
If Mid(Rubrixform.TextBox1.Value, i, 1) = "f" Then
If Mid(Rubrixform.TextBox1.Value, i+1, 1) = "'" Then
RubixFi
Else
RubixF
If Mid(Rubrixform.TextBox1.Value, i, 1) = "r" Then
If Mid(Rubrixform.TextBox1.Value, i+1, 1) = "'" Then
Rubixri
Else
Rubixr
If Mid(Rubrixform.TextBox1.Value, i, 1) = "u" Then
If Mid(Rubrixform.TextBox1.Value, i+1, 1) = "'" Then
RubixUi
Else
RubixU
If Mid(Rubrixform.TextBox1.Value, i, 1) = "d" Then
If Mid(Rubrixform.TextBox1.Value, i+1, 1) = "'" Then
Rubixdi
Else
Rubixd
If Mid(Rubrixform.TextBox1.Value, i, 1) = "l" Then
If Mid(Rubrixform.TextBox1.Value, i+1, 1) = "'" Then
Rubixli
Else
Rubixl
Next i
End Sub