LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Tom is offline
external usenet poster
 
Posts: 2
Default Looking for cells with variable in cell text

Hi,

I need to search through a column of data to see if within a cell the
variable (OptionName - i.e. the 'name' or text of another cell) is
contained in that cell's text.

E.g. OptionName = General

Therefore the macro will find the cell which contains for example:

Overall Design (General)
or
General Designs
or
General (abcd)
or whatever...

This is just some of the code but i would like to be able to keep the
DO LOOP UNTIL format if possible.

Range("A5:A1000").Select

Do
ActiveCell.Offset(1, 0).Select
Loop Until ActiveCell.Value = OptionName Or ActiveCell.Value = 0
If ActiveCell.Value = OptionName Then
...........etc

Above code would obviously just look for cells which have the same
name as the variable. So i've tried the following combinations but
none of them work.

Loop Until ActiveCell.Value = "*" & OptionName & "*" Or
ActiveCell.Value = 0
Loop Until ActiveCell.Value = "*OptionName*" Or ActiveCell.Value = 0
Loop Until ActiveCell.Value = "*(OptionName)*" Or ActiveCell.Value = 0
Loop Until ActiveCell.Value = a & OptionName & b Or ActiveCell.Value =
0 'where a and b are "*", " ", "", etc.

Any suggestions?

Thanks in advance,

Tom
 
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 do i count text cells in excel based on variable criteria? anmaka57 Excel Worksheet Functions 2 January 26th 10 04:00 PM
How capture a date variable within a text cell? Capture a variable date & use with text[_2_] Excel Discussion (Misc queries) 4 November 28th 08 02:34 AM
Concatenate Variable Array of Text Cells atryon Excel Discussion (Misc queries) 3 August 29th 08 11:57 PM
Remove variable text in cells BHalberstater Excel Worksheet Functions 3 August 16th 05 04:37 AM
check variable(text) with cell (text), textbox Mark[_17_] Excel Programming 1 August 27th 03 01:15 PM


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