Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 154
Default MACRO TO FIND SUBSTRING OR SUBTEXT !



Each cell in Range("B2:B5000") contains an alphanumeric word. I need a
*macro* that will loop through every cell in the range. If any word in
any cell in the range contains the substring or subtext "LL7P" then that
cell is to be colored red.

Any help would be greatly appreciated.

Thanks.
Jay Dean

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default MACRO TO FIND SUBSTRING OR SUBTEXT !

For Each cell In Range("B2:B5000")
If cell,Value Like ("*LL7P*") Then
cell.Interior.Colorindex = 3
End If
Next cell

--

HTH

RP
(remove nothere from the email address if mailing direct)


"jay dean" wrote in message
...


Each cell in Range("B2:B5000") contains an alphanumeric word. I need a
*macro* that will loop through every cell in the range. If any word in
any cell in the range contains the substring or subtext "LL7P" then that
cell is to be colored red.

Any help would be greatly appreciated.

Thanks.
Jay Dean

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 154
Default MACRO TO FIND SUBSTRING OR SUBTEXT !



Bob - This works excellently, and thanks a lot !
I have a follow-up question and a general one.

1. In the line "If cell.Value Like ("*LL7P*").." what is "Like"? Is it a
property of the cell object?.. and how do I use the VBA help or other
resources to learn these things?

2.When/How is the ampersand "&" used in cell formulas, or concatenating
text in VBA?

Thanks for all that you do!
Jay Dean

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default MACRO TO FIND SUBSTRING OR SUBTEXT !

Jay,

No, Like is an operator. Essentially, it allows a wildcard test by saying
*LLP7*. Take a look at 'Like Operator' in VBA Help. UN fortunately, VBA Help
is like any other Help, it assumes you know what you are looking for, it is
of no help if you don't know how to express you question.

I don't understand the second question. Your question seems to articulate it
perfectly, & is used to concatenate strings.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"jay dean" wrote in message
...


Bob - This works excellently, and thanks a lot !
I have a follow-up question and a general one.

1. In the line "If cell.Value Like ("*LL7P*").." what is "Like"? Is it a
property of the cell object?.. and how do I use the VBA help or other
resources to learn these things?

2.When/How is the ampersand "&" used in cell formulas, or concatenating
text in VBA?

Thanks for all that you do!
Jay Dean

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



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
substring Satyanaidu Excel Discussion (Misc queries) 2 September 11th 09 09:33 AM
Substring Ldyflyr Excel Discussion (Misc queries) 0 February 15th 07 03:16 PM
Substring Petya Excel Discussion (Misc queries) 0 February 15th 07 02:53 PM
Can excel macro access SUBstring individual 'char' level? If so how? bxc2739 Excel Discussion (Misc queries) 1 April 25th 06 03:58 PM
subtext in Excel MarLooting Excel Discussion (Misc queries) 3 January 15th 05 03:11 AM


All times are GMT +1. The time now is 10:25 PM.

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"