Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Cells.Replace need to keep track of result

Hello all,

Quick question. I need to keep track of whether or not the Cells.Replace is
successful in finding and replacing. I've created a Boolean variable
(isfound) and set it to the Cells.Replace and an integer (found_count) for
the counter but it (isfound) keeps returning 'True' even though the
'What:=lookup_val' I know didn't find anything.

Secondly I need to take the found_count and display this value using a
dialogue box. Is this possible if so can anyone provide an example.

code snip (xl2k):

Dim found_count As Integer
Dim isfound As Boolean

isfound = repl_wks.Cells.Replace(What:=lookup_val, Replacement:=repl_val,
LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False)

If isfound = True Then
found_count = found_count + 1
End If



Thanks,
Sriram


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Cells.Replace need to keep track of result

Well just figured out that Cells.Replace always returns TRUE. So, is there
a way to track the number of times a 'find & replace' is successfull (ie.
number of replacements made)?

Thanks,
Sriram




"Sriram" wrote in message
...
Hello all,

Quick question. I need to keep track of whether or not the Cells.Replace

is
successful in finding and replacing. I've created a Boolean variable
(isfound) and set it to the Cells.Replace and an integer (found_count) for
the counter but it (isfound) keeps returning 'True' even though the
'What:=lookup_val' I know didn't find anything.

Secondly I need to take the found_count and display this value using a
dialogue box. Is this possible if so can anyone provide an example.

code snip (xl2k):

Dim found_count As Integer
Dim isfound As Boolean

isfound = repl_wks.Cells.Replace(What:=lookup_val, Replacement:=repl_val,
LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False)

If isfound = True Then
found_count = found_count + 1
End If



Thanks,
Sriram




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Cells.Replace need to keep track of result

Hello all,

Solved my problem. I used .Find for the counter.

Thanks,
Sriram


"Sriram" wrote in message
...
Well just figured out that Cells.Replace always returns TRUE. So, is

there
a way to track the number of times a 'find & replace' is successfull (ie.
number of replacements made)?

Thanks,
Sriram




"Sriram" wrote in message
...
Hello all,

Quick question. I need to keep track of whether or not the

Cells.Replace
is
successful in finding and replacing. I've created a Boolean variable
(isfound) and set it to the Cells.Replace and an integer (found_count)

for
the counter but it (isfound) keeps returning 'True' even though the
'What:=lookup_val' I know didn't find anything.

Secondly I need to take the found_count and display this value using a
dialogue box. Is this possible if so can anyone provide an example.

code snip (xl2k):

Dim found_count As Integer
Dim isfound As Boolean

isfound = repl_wks.Cells.Replace(What:=lookup_val,

Replacement:=repl_val,
LookAt:=xlPart, SearchOrder _
:=xlByRows, MatchCase:=False)

If isfound = True Then
found_count = found_count + 1
End If



Thanks,
Sriram






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
replace a negative result with a zero? Pam2277 Excel Discussion (Misc queries) 2 April 19th 10 05:33 PM
How to replace formula with its result jclown Excel Worksheet Functions 2 March 17th 10 09:59 AM
Replace a vlookup #N/A result with a value Brandon Excel Worksheet Functions 2 August 9th 07 05:40 PM
Replace ^ in web query result Don Guillett Excel Worksheet Functions 0 April 26th 06 03:42 PM
Replace data with the result of a formula Jim K Excel Discussion (Misc queries) 3 December 8th 05 01:54 PM


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