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

I have a macro that I use to replace the contents of cells on a
worksheet which have a comment attached with an "F" in the cell (in
place of an asterisk "*"). It works fine most of the time but at
times when I run it fails miserably changing the contents of all non-
blank cells in the workbook to "F". It seems that it does this
because the "within" setting in my Find and Replace wizard has been
set to "Workbook" rather than "Sheet" prior to running the macro.

The relevant lines of code in my macro (which were recorded) are

Selection.SpecialCells(xlCellTypeComments).Select
Selection.Replace What:="*", Replacement:="F", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False,
_
ReplaceFormat:=False

I surmised that the LookAt:=xlPart was the bit of code that should set
the search to sheet only, but it doesn't seem to be doing what I think
it should be doing.

I guess this is probably a quite simple thing, but if someone could
help me resolve it it would be appreciated.

TIA
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
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 01:30 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"