Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Easy Userform question
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Easy Userform question
It would be something like this: Private Sub CommandButton1_Click() Range(txt1.Text & ":" & txt1.Text).Select End Sub -- Robin Hammond www.enhanceddatasystems.com "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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Easy question | Excel Discussion (Misc queries) | |||
Hopefully an easy question | Excel Worksheet Functions | |||
Easy VBA question | Excel Discussion (Misc queries) | |||
Easy Question | Excel Worksheet Functions | |||
new user with easy question? not easy for me | New Users to Excel |