ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pattern Matching with cells function (https://www.excelbanter.com/excel-programming/302746-pattern-matching-cells-function.html)

John[_80_]

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

Chip Pearson

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




keepITcool

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






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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com