Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default begins with, not equals, using activecell.value

What's the VB command, in an Excel macro, to determine if a cell begins with
certain words?

Quite frequently, I use the command: If ActiveCell.Value = "Specific Words"
Then etc.

But now I want to search for a cell that begins with the words "Up to ..."
But the rest of the sentence can be 150 different things so it's not
practical for me to search for every combination of words.

So, how do I say "if the cell begins with the words 'Up to' Then ...?

I searched on the web and in Excel "help" and became thoroughly confused.
Thanks, in advance.

Dan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default begins with, not equals, using activecell.value

Here is one possiblity

If ActiveCell.Value Like "Up to*" Then MsgBox "Found"

You could also use InStr function to find the position of a phrase within a
string...
--
HTH...

Jim Thomlinson


"crimsonkng" wrote:

What's the VB command, in an Excel macro, to determine if a cell begins with
certain words?

Quite frequently, I use the command: If ActiveCell.Value = "Specific Words"
Then etc.

But now I want to search for a cell that begins with the words "Up to ..."
But the rest of the sentence can be 150 different things so it's not
practical for me to search for every combination of words.

So, how do I say "if the cell begins with the words 'Up to' Then ...?

I searched on the web and in Excel "help" and became thoroughly confused.
Thanks, in advance.

Dan

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default begins with, not equals, using activecell.value

Like! I should have known.
It works perfectly. Thanks.
Dan

"Jim Thomlinson" wrote:

Here is one possiblity

If ActiveCell.Value Like "Up to*" Then MsgBox "Found"

You could also use InStr function to find the position of a phrase within a
string...
--
HTH...

Jim Thomlinson


"crimsonkng" wrote:

What's the VB command, in an Excel macro, to determine if a cell begins with
certain words?

Quite frequently, I use the command: If ActiveCell.Value = "Specific Words"
Then etc.

But now I want to search for a cell that begins with the words "Up to ..."
But the rest of the sentence can be 150 different things so it's not
practical for me to search for every combination of words.

So, how do I say "if the cell begins with the words 'Up to' Then ...?

I searched on the web and in Excel "help" and became thoroughly confused.
Thanks, in advance.

Dan

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
If statement - begins with grantr Excel Discussion (Misc queries) 6 October 31st 08 06:35 PM
If activecell.column = variable then activecell,offset (0,1) Battykoda via OfficeKB.com Excel Discussion (Misc queries) 1 October 2nd 07 08:05 PM
If a cell equals _, at the next row that equals _, return value fr CathyH Excel Worksheet Functions 10 May 2nd 07 07:53 PM
if a:a (range) equals january and c:c equals gas then add g:g ($) BCOz Excel Worksheet Functions 4 December 29th 05 07:40 PM
custom filter does not work when selecting 'equals' X AND 'equals' plindman Excel Discussion (Misc queries) 1 June 1st 05 11:29 PM


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

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"