D dukejas Nov 11, 2003 #1 How to get rid of string which contain a substring like 'PO BOX'. Is that 'Like', it doesn't work. Thanks!
How to get rid of string which contain a substring like 'PO BOX'. Is that 'Like', it doesn't work. Thanks!
T Tom Ogilvy Nov 11, 2003 #2 Dim sStr as String sStr = " the address contains a po box reference" if instr(1, sStr, "po box", vbTextCompare) then ' it contains the substring "po box" End if
Dim sStr as String sStr = " the address contains a po box reference" if instr(1, sStr, "po box", vbTextCompare) then ' it contains the substring "po box" End if
P pfsardella Nov 11, 2003 #3 Sub NoPO() Dim rngP As Range For Each rngP In Selection If InStr(1, rngP.Value, "PO BOX", vbTextCompare) Then _ rngP.ClearContents Next rngP End Sub Tested using Excel 97SR2 on Windows 98SE, HTH Paul
Sub NoPO() Dim rngP As Range For Each rngP In Selection If InStr(1, rngP.Value, "PO BOX", vbTextCompare) Then _ rngP.ClearContents Next rngP End Sub Tested using Excel 97SR2 on Windows 98SE, HTH Paul