error message

Lino

Active Member
Joined
Feb 27, 2002
Messages
429
i have the following code in vba:

Columns("C:C").Select
Selection.Replace What:="/", Replacement:=".", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False

after my procedure runs i get a message box with an exlcamation point saying that it couldn't find anything to replace.

how do i supress this?

thanks

Lino
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Have you tried Application.DisplayAlerts=False
 
Upvote 0
i am finding that if i place:

Application.DisplayAlerts = false right before the replace statement and do not turn it back on then the warning message will not appear.

so i am lead to believe that microsoft hold on to this warning message and when i set:

Application.DisplayAlerts back to true it displays the warning message...

so i want to clear this message and then set DisplayAlerts back to true...

how can this be done?

thanks,

Lino
 
Upvote 0
Application.DisplayAlerts = False
Columns("C:C").Select
On Error Resume Next
Selection.Replace What:="/", Replacement:=".", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Application.DisplayAlerts = True



This supresses the message.
 
Upvote 0
thank you for your solution i will implement it...

can anyone explain this:

what is interesting is that usually when i save a workbook i always precede the save statement with displayalerts = false and then immediately follow it with a displayalerts = true

Application.DisplayAlerts=false
Workbook.Save
Application.DisplayAlerts=true

the interesting thing is that the warning message that would be generated above does not resurface once i set displayalerts =true where in the Find/Replace code it does..

Does anyone know why this is?

thanks,

Lino
 
Upvote 0

Forum statistics

Threads
1,214,858
Messages
6,121,960
Members
449,057
Latest member
FreeCricketId

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top