Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Find and Replace

Using VBA, is it possible to search a range for a value in one cell and
replace with a value in another cell? I have tried using the Record Macro
option and recorded the following (which, of course, does not work).

Application.Goto Reference:="SearchArea"
Cells.Replace What:=Range("R2C2"), Replacement:=Range("R2C3"),
LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub

How can I modify it to make it work?

Any help is greatly appreciated.


--
molinaram
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Find and Replace

Sub rplc()
Cells.Replace What:=Range("B2").Value, Replacement:=Range("C2").Value,
LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub


"molinaram" wrote:

Using VBA, is it possible to search a range for a value in one cell and
replace with a value in another cell? I have tried using the Record Macro
option and recorded the following (which, of course, does not work).

Application.Goto Reference:="SearchArea"
Cells.Replace What:=Range("R2C2"), Replacement:=Range("R2C3"),
LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub

How can I modify it to make it work?

Any help is greatly appreciated.


--
molinaram

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Find and Replace

Thank you, Thank you, thank you. This is going to be such a time saver.
--
molinaram


"JLGWhiz" wrote:

Sub rplc()
Cells.Replace What:=Range("B2").Value, Replacement:=Range("C2").Value,
LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub


"molinaram" wrote:

Using VBA, is it possible to search a range for a value in one cell and
replace with a value in another cell? I have tried using the Record Macro
option and recorded the following (which, of course, does not work).

Application.Goto Reference:="SearchArea"
Cells.Replace What:=Range("R2C2"), Replacement:=Range("R2C3"),
LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub

How can I modify it to make it work?

Any help is greatly appreciated.


--
molinaram

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
Find and Replace - Replace with Blank Space Studebaker Excel Discussion (Misc queries) 4 April 3rd 23 10:55 AM
Find/Replace Event or Find/Replace for Protected Sheet ... Joe HM Excel Programming 2 October 27th 07 03:55 PM
find and replace - replace data in rows to separated by commas msdker Excel Worksheet Functions 1 April 15th 06 01:00 AM
Using Find and Replace to replace " in a macro snail30152 Excel Programming 1 April 13th 06 11:58 PM
Replace method - cannot find any data to replace Mike Excel Programming 5 April 6th 06 08:56 PM


All times are GMT +1. The time now is 10:54 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"