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
 

Some videos you may like

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Lino

Active Member
Joined
Feb 27, 2002
Messages
429
yes and it is not working...very strange...and frustrating
 

Lino

Active Member
Joined
Feb 27, 2002
Messages
429

ADVERTISEMENT

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
 

XLGibbs

Well-known Member
Joined
Feb 25, 2005
Messages
2,446
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.
 

Lino

Active Member
Joined
Feb 27, 2002
Messages
429
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
 

Watch MrExcel Video

Forum statistics

Threads
1,118,438
Messages
5,572,117
Members
412,440
Latest member
kelethymos
Top