Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Pattern Matching with cells function

Hi all, I looked for an answer to this one but can't find it. Your
help is always appreciated.

-------------------------
dim bottom as long
bottom = Cells(Rows.count, "B").End(xlUp).Row

For a = bottom To 3 Step -1
If Cells(a, 4) = "*Abstractor" Then
Cells(a - 1, 10) = Cells(a, 7)
Cells(a - 1, 11) = Cells(a, 8)
End If

Next a
--------------------------

It seems to me that the * character is not acting like a wild card for
me. What is the proper way to look through the cells and try to match
a pattern?

Thanks
John
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Pattern Matching with cells function

John,

Use the LIKE operator. E.g,

If Cells(a,4) Like "*Abstractor" Then



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"John" wrote in message
m...
Hi all, I looked for an answer to this one but can't find it.

Your
help is always appreciated.

-------------------------
dim bottom as long
bottom = Cells(Rows.count, "B").End(xlUp).Row

For a = bottom To 3 Step -1
If Cells(a, 4) = "*Abstractor" Then
Cells(a - 1, 10) = Cells(a, 7)
Cells(a - 1, 11) = Cells(a, 8)
End If

Next a
--------------------------

It seems to me that the * character is not acting like a wild

card for
me. What is the proper way to look through the cells and try to

match
a pattern?

Thanks
John



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Pattern Matching with cells function

note that LIKE is case sensitive
(unless OPTION COMPARE TEXT has been set in the module's decl. section)

keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Chip Pearson" wrote:

John,

Use the LIKE operator. E.g,

If Cells(a,4) Like "*Abstractor" Then




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
Function to Produce a Number Pattern? mommy2kh Excel Worksheet Functions 1 July 15th 08 08:29 AM
Pattern Matching [email protected] Excel Discussion (Misc queries) 6 September 24th 07 09:19 PM
Matching and Aligning Cells Formula/Function? Macro? [email protected] Excel Worksheet Functions 1 July 6th 06 06:19 AM
pattern matching possible? vito Excel Worksheet Functions 1 May 16th 06 05:03 PM
Wildcard pattern matching and replace in string Janelle Excel Programming 0 August 7th 03 10:43 PM


All times are GMT +1. The time now is 05:08 PM.

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"