LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default find text within string and then delete

If InStr(1, UCase(c.Value), "REPORT") Then

The InStr function has two optional arguments... the first which is a
starting position for the search (InStr is an unusual function in its having
an optional *first* argument) and, if the first argument is specified, a
fourth which allows you to make it perform a non case sensitive search. So,
using your UCase approach as shown above, the function call could have been
simplified to this...

If InStr(UCase(c.Value), "REPORT") Then

but using the first and fourth arguments would allow us to eliminate the
UCase function call...

If InStr(1, c.Value, "Report", vbTextCompare) Then

where the letters in the word "Report" can be in any case (here I use the
more friendly looking, at least to me, "proper" case).

--
Rick (MVP - Excel)



 
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
Delete part of a text string IanP Excel Worksheet Functions 3 April 6th 09 12:34 PM
Function to read text file; find string; delete same before import [email protected] Excel Programming 32 August 5th 08 10:50 PM
Delete text in a string marco help Chuong Nguyen Excel Programming 4 January 11th 08 01:08 AM
Find part of string & delete row Les Stout[_2_] Excel Programming 4 October 13th 05 03:09 PM
backwards find function to find character in a string of text Ashleigh K. Excel Programming 1 January 14th 04 04:36 PM


All times are GMT +1. The time now is 08:47 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"