Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to get rid of string which contain a substring like 'PO BOX'.


How to get rid of string which contain a substring like 'PO BOX'.

Is that 'Like', it doesn't work.

Thanks!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to get rid of string which contain a substring like 'PO BOX'.

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

--
Regards,
Tom Ogilvy

dukejas wrote in message
...

How to get rid of string which contain a substring like 'PO BOX'.

Is that 'Like', it doesn't work.

Thanks!


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default How to get rid of string which contain a substring like 'PO BOX'.

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
--------------------------------------------------------------------------------------------------------------
Be advised to back up your WorkBook before attempting to make changes.
--------------------------------------------------------------------------------------------------------------
How to get rid of string which contain a substring like 'PO BOX'.

Is that 'Like', it doesn't work.

Thanks!



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
How to delete a 'Select Box' Bodin Excel Discussion (Misc queries) 1 April 28th 09 01:53 AM
search a string as substring and give adjacent values Eddy Stan Excel Worksheet Functions 1 June 23rd 08 03:05 PM
Create a 'check box' in Excel gail Excel Discussion (Misc queries) 1 October 9th 06 01:51 AM
How do I create a column that has a 'drop box' Dave Simons Excel Worksheet Functions 1 November 1st 04 01:57 PM
How do I create a column that has a 'drop box' Dave Simons Excel Worksheet Functions 1 October 27th 04 07:57 PM


All times are GMT +1. The time now is 03:16 PM.

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"