Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ron Ron is offline
external usenet poster
 
Posts: 250
Default Find and Replace with contents of cell

I have a range of cells, A5:C42, with multiple instances in the format
00-00-00.

Cell A4 has the date in the format 06-01-10.

I want to use a quick macro attacked to a picture that replaces the 00-00-00
with the 06-01-10 in all instances.

A hard coded:
Range("A5:C42").Select
Selection.Replace What:="00-00-00", Replacement:="06-01-10", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False

works fine, but I do this daily and monthly and don't want to edit the macro
each day. I need the Replacement: equal to cell A4.

Thanks,
Ron
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Find and Replace with contents of cell

If you wanted to use today's date, you could drop the A4 entry:

Dim myDateStr as string
mydatestr = format(date,"mm-dd-yy")
selection.replace what:="00-00-00", replacement:=mydatestr, ...

But if you have a real date in A4 of the activesheet and want to use that date:

mydatestr = format(activesheet.range("a4").value,"mm-dd-yy")
selection.replace what:="00-00-00", replacement:=mydatestr, ...

Ron wrote:

I have a range of cells, A5:C42, with multiple instances in the format
00-00-00.

Cell A4 has the date in the format 06-01-10.

I want to use a quick macro attacked to a picture that replaces the 00-00-00
with the 06-01-10 in all instances.

A hard coded:
Range("A5:C42").Select
Selection.Replace What:="00-00-00", Replacement:="06-01-10", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False

works fine, but I do this daily and monthly and don't want to edit the macro
each day. I need the Replacement: equal to cell A4.

Thanks,
Ron


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Find and Replace with contents of cell

Range("A5:C42").Select
Selection.Replace What:="00-00-00", Replacement:=Range("A4"), LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Ron" wrote:

I have a range of cells, A5:C42, with multiple instances in the format
00-00-00.

Cell A4 has the date in the format 06-01-10.

I want to use a quick macro attacked to a picture that replaces the 00-00-00
with the 06-01-10 in all instances.

A hard coded:
Range("A5:C42").Select
Selection.Replace What:="00-00-00", Replacement:="06-01-10", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False

works fine, but I do this daily and monthly and don't want to edit the macro
each day. I need the Replacement: equal to cell A4.

Thanks,
Ron

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Find and Replace with contents of cell

Thanks, that's what I was looking for. I couldn't figure out the format.

Actually, all the answer will work, but this one is a better fit.

Thanks to all
Ron

"ryguy7272" wrote:

Range("A5:C42").Select
Selection.Replace What:="00-00-00", Replacement:=Range("A4"), LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Ron" wrote:

I have a range of cells, A5:C42, with multiple instances in the format
00-00-00.

Cell A4 has the date in the format 06-01-10.

I want to use a quick macro attacked to a picture that replaces the 00-00-00
with the 06-01-10 in all instances.

A hard coded:
Range("A5:C42").Select
Selection.Replace What:="00-00-00", Replacement:="06-01-10", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False

works fine, but I do this daily and monthly and don't want to edit the macro
each day. I need the Replacement: equal to cell A4.

Thanks,
Ron

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
Copy contents of Find (Find and Replace) rob_bob Excel Discussion (Misc queries) 0 March 26th 09 11:01 PM
Find & Replace part of cell contents JASelep Excel Programming 3 October 15th 07 10:25 PM
Replace #VALUE! with contents of cell?? MOK Excel Worksheet Functions 1 March 16th 07 10:33 AM
Find and Replace Hyperlink Contents Dede Excel Discussion (Misc queries) 11 April 29th 05 12:29 AM
replace cell contents Nancy B Excel Worksheet Functions 2 March 16th 05 04:39 PM


All times are GMT +1. The time now is 08:44 PM.

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"