Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 575
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Easy question Excel Wired Excel Discussion (Misc queries) 2 July 29th 09 04:53 PM
Hopefully an easy question Yookaroo Excel Worksheet Functions 4 July 7th 09 08:31 PM
Easy VBA question Dallman Ross Excel Discussion (Misc queries) 2 August 6th 07 01:26 AM
Easy Question Bob[_8_] Excel Worksheet Functions 9 July 14th 07 03:50 PM
new user with easy question? not easy for me speakeztruth New Users to Excel 5 June 3rd 05 09:40 PM


All times are GMT +1. The time now is 08:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"