Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 95
Default check variable(text) with cell (text), textbox

I have a problem with compare variable (text-word) with
contents cell (text), textbox , which have many words.
If any cell, textbox contain word like variable (text)
then execute another macro.

Code below don't produce effect:

Sub compare()

Dim word as String
Dim words as String

If word Like words Then
'another macro
End if

End sub

Is there an easy solution of this problem?

Best regards
Mark
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default check variable(text) with cell (text), textbox

I use Like operator quite a bit and it works quite well. Your code seems OK
so if it doesn't work look into what you have in 'word' and 'words'. You
can also try InStr:

word = "banana"
words = "banana,apple,orange"
if instr(words,word & ",") then call Fruity(word)

if words like "*" & word & "*" then call fruity(word) 'works as well

"Mark" wrote in message
...
I have a problem with compare variable (text-word) with
contents cell (text), textbox , which have many words.
If any cell, textbox contain word like variable (text)
then execute another macro.

Code below don't produce effect:

Sub compare()

Dim word as String
Dim words as String

If word Like words Then
'another macro
End if

End sub

Is there an easy solution of this problem?

Best regards
Mark



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
Macro - Fixed text code needs replacing with variable text steven.holloway Excel Discussion (Misc queries) 3 July 22nd 08 03:57 PM
Check if cell contains certain text jhockstr Excel Worksheet Functions 2 August 25th 05 09:32 AM
Putting text in a column based on variable text from another colum Jacky D. Excel Discussion (Misc queries) 1 December 16th 04 06:09 PM
How to copy text from a TextBox in a ActiveSheet to a variable Tom Ogilvy Excel Programming 2 August 19th 03 06:35 PM
How to copy text from a TextBox in a ActiveSheet to a variable pat Excel Programming 0 August 19th 03 05:06 PM


All times are GMT +1. The time now is 09:45 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"