Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Replace is n/a in Excel 07, along with various other string manipulation
functions. To cater for all versions do it like this Dim sOld As String, sNew 'code sOld = cell.Value #If VBA6 Then ' Excel 2000 or later sNew = Replace(Replace(Replace(sOld, "~", "~~"), "*", "~*"), "?", "~?") #Else ' Excel 97 With Application.WorksheetFunction sRep = .Substitute(.Substitute(.Substitute(sOld, _ "~", "~~"), "*", "~*"), "?", "~?") End With #End If My_Range.AutoFilter Field:=FieldNum, Criteria1:="=" & sNew Regards, Peter T "Monk" wrote in message ... I get an error on the Replace part of the following code for people who are still using Excel 97. I have tried using substitute instead but this also does not seem to work. Any suggestions would be appreciated. My_Range.AutoFilter Field:=FieldNum, Criteria1:="=" & _ Replace(Replace(Replace(cell.Value, "~", "~~"), "*", "~*"), "?", "~?") |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VB Excel Code returning my error message twice instead of once.... | Excel Programming | |||
Code Error Message Excel 2000 - 2003 | Excel Programming | |||
Need Error Message Box In VBA Code - Excel 2000 & 2003 | Excel Programming | |||
"File Is Locked" Error Message (not by other users) | Excel Discussion (Misc queries) | |||
Help with Error Message Box code | Excel Programming |