Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default What's wrong here?

The code below inserts loads of incorrect values all over the place, rather
than in the hoped for areas. any ideas? I'm trying to search and replace
values typed into cells which reference another sheet. E.G. replace contents
of variable1 with say contents of C1 (typed in sheet 1) but also replace
variable 1 found on say sheet 3.
Here's what i have...

With Sheets("Sheet1")
.Cells.Replace Sheets("Sheet2").Range("c6"), .Range("a6"),
LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False,
ReplaceFormat:=False
End With

many thanks

Rob
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default What's wrong here?

If you are getting replacements "all over the place", I would suspect the
parameter LookAt:=xlPart is allowing substring matches in the other cells.
What happens if you change that parameter to LookAt:=xlWhole?

Rick


"Beebolbod" wrote in message
...
The code below inserts loads of incorrect values all over the place,
rather
than in the hoped for areas. any ideas? I'm trying to search and replace
values typed into cells which reference another sheet. E.G. replace
contents
of variable1 with say contents of C1 (typed in sheet 1) but also replace
variable 1 found on say sheet 3.
Here's what i have...

With Sheets("Sheet1")
.Cells.Replace Sheets("Sheet2").Range("c6"), .Range("a6"),
LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False,
ReplaceFormat:=False
End With

many thanks

Rob


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default What's wrong here?

hI,

That didn't solve it. I get a value (one of my intended variable values)
inserted in every cell in almost every column in many worksheets.
I only want my search and replace to reference a specific worksheet.

Thanks

Rob

"Rick Rothstein (MVP - VB)" wrote:

If you are getting replacements "all over the place", I would suspect the
parameter LookAt:=xlPart is allowing substring matches in the other cells.
What happens if you change that parameter to LookAt:=xlWhole?

Rick


"Beebolbod" wrote in message
...
The code below inserts loads of incorrect values all over the place,
rather
than in the hoped for areas. any ideas? I'm trying to search and replace
values typed into cells which reference another sheet. E.G. replace
contents
of variable1 with say contents of C1 (typed in sheet 1) but also replace
variable 1 found on say sheet 3.
Here's what i have...

With Sheets("Sheet1")
.Cells.Replace Sheets("Sheet2").Range("c6"), .Range("a6"),
LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False, SearchFormat:=False,
ReplaceFormat:=False
End With

many thanks

Rob



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
Insert Calculated Field (wrong Qty*Price = wrong Amount) Edmund Excel Discussion (Misc queries) 8 October 4th 07 12:13 PM
i did something wrong Roy Excel Discussion (Misc queries) 3 October 9th 06 10:45 PM
What am I doing wrong? sgl Excel Programming 2 October 5th 05 12:25 PM
Where am I going wrong? Pank Excel Discussion (Misc queries) 2 July 13th 05 01:05 PM
Where am I going wrong with this? [email protected] Excel Programming 1 May 25th 04 05:04 PM


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