LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Isa Isa is offline
external usenet poster
 
Posts: 16
Default Search/replace Userform Variable

I've done this in Word, but can't seem to get it to work in Excel. I have a
Userform wherein the user types some text (variable1). When the user clicks
on the "continue" button I want the code behind that button to Search and
Replace the predefined text in the worksheet and replace it with the
variable1 text that the user typed. If I record the keystrokes for search and
replace, the macros works, but it does not work after putting that code in
the button code because I don't know how/where to put the "variable1". In
Word, it looked like this:


Private Sub CommandButton1_Click()
Dim variable1 As String
variable1 = FillInDate.DateBox.Text
Cells.Find(What:="C4", After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False) _
.Activate
Cells.Replace What:="C4", Replacement:="C5", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
<<<
Any help out there?

 
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
Search and replace Rockbear Excel Worksheet Functions 0 October 13th 08 08:25 AM
Search and replace CatPEG Excel Discussion (Misc queries) 4 January 7th 08 04:31 AM
Search and Replace Abdul Excel Discussion (Misc queries) 2 March 23rd 06 02:38 PM
Help with search and Replace icdoo Excel Programming 5 September 18th 05 12:03 AM
Variable in a Search and Replace macro Sandy Excel Programming 4 April 25th 05 07:35 PM


All times are GMT +1. The time now is 07:26 AM.

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

About Us

"It's about Microsoft Excel"