Easy Userform question
Hi David,
Here is a starter
Private Sub CommandButton1_Click()
Dim iCol As Long
With TextBox1
If Len(.Text) 2 Then
MsgBox "Invalid entry"
ElseIf Len(.Text) = 2 Then
iCol = 26 * (Asc(Left(.Text, 1)) - 64) + Asc(Right(.Text, 1)) -
64
Else
iCol = Asc(.Text) - 64
End If
End With
MsgBox iCol
ActiveSheet.Columns(iCol).Replace _
What:="end", _
Replacement:="final", _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
MatchCase:=False
End Sub
--
HTH
Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
"David Jensen" wrote in message
...
Hi everyone. I apologize in advance for the simple question...
I have a userform with a textbox that a user will input a column
identifier
into. For instance they will enter F in the textbox and after clicking
the
command button on the bottom of the form the program will select the
entire
column F and replace each instance of, say, the word "end" with the word
"final". It will do more than this but I just need help getting started
on
how to select the column based on the user's input into the textbox on the
userform.
Thanks in advance so much for the help.
Dave
|