Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default The "Like" operator.

Dear all;

I have a front sheet were in a cell named txtrole one can enter a role (like
manager).
I want to search a column in a database on another sheet (Database) and find
all cells that contain the word manager.
So, manager qualifies, but lead manager also qualifies.
When a match is found, I want to copy the whole row to the first worksheet.

The code I developped -and which is not working- is written below.
Take into consideration that the code does start in the appropriate cell,
but that this part of the code is outside this sub.

Private Sub Check_02()
'Check Role
x2 = Worksheets("Front").Range("txtRole").Value
Do Until IsEmpty(ActiveCell)
If Application.Proper(ActiveCell.Offset(0, 4).Value) Like
Application.Proper(x2) Then
ActiveCell.EntireRow.Copy WF.Range("B20").Offset(i, -1)
i = i + 1
j = j + 1
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub

---

What must I change so that I can check how many cells qualify.
Do I use the like operator right or do I have to do this differently.

Mark.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default The "Like" operator.

Don't you just want

Private Sub Check_02()
'Check Role
x2 = Worksheets("Front").Range("txtRole").Value
Do Until IsEmpty(ActiveCell)
If ActiveCell.Offset(0, 4).Value Like "*manager*"
ActiveCell.EntireRow.Copy WF.Range("B20").Offset(i, -1)
i = i + 1
j = j + 1
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub


--
HTH

Bob Phillips

"Spreadsheet Solutions" wrote in message
...
Dear all;

I have a front sheet were in a cell named txtrole one can enter a role

(like
manager).
I want to search a column in a database on another sheet (Database) and

find
all cells that contain the word manager.
So, manager qualifies, but lead manager also qualifies.
When a match is found, I want to copy the whole row to the first

worksheet.

The code I developped -and which is not working- is written below.
Take into consideration that the code does start in the appropriate cell,
but that this part of the code is outside this sub.

Private Sub Check_02()
'Check Role
x2 = Worksheets("Front").Range("txtRole").Value
Do Until IsEmpty(ActiveCell)
If Application.Proper(ActiveCell.Offset(0, 4).Value) Like
Application.Proper(x2) Then
ActiveCell.EntireRow.Copy WF.Range("B20").Offset(i, -1)
i = i + 1
j = j + 1
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub

---

What must I change so that I can check how many cells qualify.
Do I use the like operator right or do I have to do this differently.

Mark.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default The "Like" operator.

If the user types in "manager" and your search is for "like 'manager'" then
it only finds the exact match, because there are no wildcards. If you want
to allow anything with "manager" in it, the proper form would be:
If Application.Proper(ActiveCell.Offset(0, 4).Value) Like "*" &
Application.Proper(x2) & "*" Then...

--
- K Dales


"Spreadsheet Solutions" wrote:

Dear all;

I have a front sheet were in a cell named txtrole one can enter a role (like
manager).
I want to search a column in a database on another sheet (Database) and find
all cells that contain the word manager.
So, manager qualifies, but lead manager also qualifies.
When a match is found, I want to copy the whole row to the first worksheet.

The code I developped -and which is not working- is written below.
Take into consideration that the code does start in the appropriate cell,
but that this part of the code is outside this sub.

Private Sub Check_02()
'Check Role
x2 = Worksheets("Front").Range("txtRole").Value
Do Until IsEmpty(ActiveCell)
If Application.Proper(ActiveCell.Offset(0, 4).Value) Like
Application.Proper(x2) Then
ActiveCell.EntireRow.Copy WF.Range("B20").Offset(i, -1)
i = i + 1
j = j + 1
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub

---

What must I change so that I can check how many cells qualify.
Do I use the like operator right or do I have to do this differently.

Mark.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default The "Like" operator.

? lcase("Lead MaNaGer Smith") Like "*manager*"
True


--
Regards,
Tom Ogilvy

"Spreadsheet Solutions" wrote in message
...
Dear all;

I have a front sheet were in a cell named txtrole one can enter a role

(like
manager).
I want to search a column in a database on another sheet (Database) and

find
all cells that contain the word manager.
So, manager qualifies, but lead manager also qualifies.
When a match is found, I want to copy the whole row to the first

worksheet.

The code I developped -and which is not working- is written below.
Take into consideration that the code does start in the appropriate cell,
but that this part of the code is outside this sub.

Private Sub Check_02()
'Check Role
x2 = Worksheets("Front").Range("txtRole").Value
Do Until IsEmpty(ActiveCell)
If Application.Proper(ActiveCell.Offset(0, 4).Value) Like
Application.Proper(x2) Then
ActiveCell.EntireRow.Copy WF.Range("B20").Offset(i, -1)
i = i + 1
j = j + 1
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub

---

What must I change so that I can check how many cells qualify.
Do I use the like operator right or do I have to do this differently.

Mark.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default The "Like" operator.

Bob;

Thanks for your quick response.
I forgot to tell something.
x2 can be manager, but also partner.
So, partner and lead partner also have to qualify in case partner is
choosen.

Your code is correct, but only for manager.
My problem is: how does this work with a variable string.

Mark.


"Bob Phillips" wrote in message
...
Don't you just want

Private Sub Check_02()
'Check Role
x2 = Worksheets("Front").Range("txtRole").Value
Do Until IsEmpty(ActiveCell)
If ActiveCell.Offset(0, 4).Value Like "*manager*"
ActiveCell.EntireRow.Copy WF.Range("B20").Offset(i, -1)
i = i + 1
j = j + 1
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub


--
HTH

Bob Phillips

"Spreadsheet Solutions" wrote in message
...
Dear all;

I have a front sheet were in a cell named txtrole one can enter a role

(like
manager).
I want to search a column in a database on another sheet (Database) and

find
all cells that contain the word manager.
So, manager qualifies, but lead manager also qualifies.
When a match is found, I want to copy the whole row to the first

worksheet.

The code I developped -and which is not working- is written below.
Take into consideration that the code does start in the appropriate cell,
but that this part of the code is outside this sub.

Private Sub Check_02()
'Check Role
x2 = Worksheets("Front").Range("txtRole").Value
Do Until IsEmpty(ActiveCell)
If Application.Proper(ActiveCell.Offset(0, 4).Value) Like
Application.Proper(x2) Then
ActiveCell.EntireRow.Copy WF.Range("B20").Offset(i, -1)
i = i + 1
j = j + 1
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub

---

What must I change so that I can check how many cells qualify.
Do I use the like operator right or do I have to do this differently.

Mark.








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default Problem Solved !!!

Thanks to K Dales !!!

"Spreadsheet Solutions" wrote in message
...
Dear all;

I have a front sheet were in a cell named txtrole one can enter a role
(like manager).
I want to search a column in a database on another sheet (Database) and
find all cells that contain the word manager.
So, manager qualifies, but lead manager also qualifies.
When a match is found, I want to copy the whole row to the first
worksheet.

The code I developped -and which is not working- is written below.
Take into consideration that the code does start in the appropriate cell,
but that this part of the code is outside this sub.

Private Sub Check_02()
'Check Role
x2 = Worksheets("Front").Range("txtRole").Value
Do Until IsEmpty(ActiveCell)
If Application.Proper(ActiveCell.Offset(0, 4).Value) Like
Application.Proper(x2) Then
ActiveCell.EntireRow.Copy WF.Range("B20").Offset(i, -1)
i = i + 1
j = j + 1
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub

---

What must I change so that I can check how many cells qualify.
Do I use the like operator right or do I have to do this differently.

Mark.



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 33
Default The "Like" operator.

You are a genius.
Ask for a salary increase !!!
I will act as a reference....

Mark.

"K Dales" wrote in message
...
If the user types in "manager" and your search is for "like 'manager'"
then
it only finds the exact match, because there are no wildcards. If you
want
to allow anything with "manager" in it, the proper form would be:
If Application.Proper(ActiveCell.Offset(0, 4).Value) Like "*" &
Application.Proper(x2) & "*" Then...

--
- K Dales


"Spreadsheet Solutions" wrote:

Dear all;

I have a front sheet were in a cell named txtrole one can enter a role
(like
manager).
I want to search a column in a database on another sheet (Database) and
find
all cells that contain the word manager.
So, manager qualifies, but lead manager also qualifies.
When a match is found, I want to copy the whole row to the first
worksheet.

The code I developped -and which is not working- is written below.
Take into consideration that the code does start in the appropriate cell,
but that this part of the code is outside this sub.

Private Sub Check_02()
'Check Role
x2 = Worksheets("Front").Range("txtRole").Value
Do Until IsEmpty(ActiveCell)
If Application.Proper(ActiveCell.Offset(0, 4).Value) Like
Application.Proper(x2) Then
ActiveCell.EntireRow.Copy WF.Range("B20").Offset(i, -1)
i = i + 1
j = j + 1
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub

---

What must I change so that I can check how many cells qualify.
Do I use the like operator right or do I have to do this differently.

Mark.





  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default The "Like" operator.

Sorry, didn't realize you couldn't expand the solution on your own:

Private Sub Check_02()
'Check Role
x2 = Worksheets("Front").Range("txtRole").Value
Do Until IsEmpty(ActiveCell)
If Application.Proper(ActiveCell.Offset(0, 4).Value) Like _
"*" & Application.Proper(x2) "*" Then
ActiveCell.EntireRow.Copy WF.Range("B20").Offset(i, -1)
i = i + 1
j = j + 1
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub

--
Regards,
Tom Ogilvy

"Spreadsheet Solutions" wrote in message
. ..
Bob;

Thanks for your quick response.
I forgot to tell something.
x2 can be manager, but also partner.
So, partner and lead partner also have to qualify in case partner is
choosen.

Your code is correct, but only for manager.
My problem is: how does this work with a variable string.

Mark.


"Bob Phillips" wrote in message
...
Don't you just want

Private Sub Check_02()
'Check Role
x2 = Worksheets("Front").Range("txtRole").Value
Do Until IsEmpty(ActiveCell)
If ActiveCell.Offset(0, 4).Value Like "*manager*"
ActiveCell.EntireRow.Copy WF.Range("B20").Offset(i, -1)
i = i + 1
j = j + 1
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub


--
HTH

Bob Phillips

"Spreadsheet Solutions" wrote in message
...
Dear all;

I have a front sheet were in a cell named txtrole one can enter a role

(like
manager).
I want to search a column in a database on another sheet (Database) and

find
all cells that contain the word manager.
So, manager qualifies, but lead manager also qualifies.
When a match is found, I want to copy the whole row to the first

worksheet.

The code I developped -and which is not working- is written below.
Take into consideration that the code does start in the appropriate

cell,
but that this part of the code is outside this sub.

Private Sub Check_02()
'Check Role
x2 = Worksheets("Front").Range("txtRole").Value
Do Until IsEmpty(ActiveCell)
If Application.Proper(ActiveCell.Offset(0, 4).Value) Like
Application.Proper(x2) Then
ActiveCell.EntireRow.Copy WF.Range("B20").Offset(i, -1)
i = i + 1
j = j + 1
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub

---

What must I change so that I can check how many cells qualify.
Do I use the like operator right or do I have to do this differently.

Mark.








  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default The "Like" operator.

Should work just fine...

instead of x2 I might use str since x2 is also a range address

Dim X2 as String

X2= Worksheets("Front").Range("txtRole")

If ActiveCell.Offset(0, 4).Value Like "*" & X2 & "*"


--
steveB

Remove "AYN" from email to respond
"Spreadsheet Solutions" wrote in message
. ..
Bob;

Thanks for your quick response.
I forgot to tell something.
x2 can be manager, but also partner.
So, partner and lead partner also have to qualify in case partner is
choosen.

Your code is correct, but only for manager.
My problem is: how does this work with a variable string.

Mark.


"Bob Phillips" wrote in message
...
Don't you just want

Private Sub Check_02()
'Check Role
x2 = Worksheets("Front").Range("txtRole").Value
Do Until IsEmpty(ActiveCell)
If ActiveCell.Offset(0, 4).Value Like "*manager*"
ActiveCell.EntireRow.Copy WF.Range("B20").Offset(i, -1)
i = i + 1
j = j + 1
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub


--
HTH

Bob Phillips

"Spreadsheet Solutions" wrote in message
...
Dear all;

I have a front sheet were in a cell named txtrole one can enter a role

(like
manager).
I want to search a column in a database on another sheet (Database) and

find
all cells that contain the word manager.
So, manager qualifies, but lead manager also qualifies.
When a match is found, I want to copy the whole row to the first

worksheet.

The code I developped -and which is not working- is written below.
Take into consideration that the code does start in the appropriate
cell,
but that this part of the code is outside this sub.

Private Sub Check_02()
'Check Role
x2 = Worksheets("Front").Range("txtRole").Value
Do Until IsEmpty(ActiveCell)
If Application.Proper(ActiveCell.Offset(0, 4).Value) Like
Application.Proper(x2) Then
ActiveCell.EntireRow.Copy WF.Range("B20").Offset(i, -1)
i = i + 1
j = j + 1
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub

---

What must I change so that I can check how many cells qualify.
Do I use the like operator right or do I have to do this differently.

Mark.








  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Problem Solved !!!

I think both Tom and I gave you that answer earlier, you just didn't look.

--
HTH

Bob Phillips

"Spreadsheet Solutions" wrote in message
...
Thanks to K Dales !!!

"Spreadsheet Solutions" wrote in message
...
Dear all;

I have a front sheet were in a cell named txtrole one can enter a role
(like manager).
I want to search a column in a database on another sheet (Database) and
find all cells that contain the word manager.
So, manager qualifies, but lead manager also qualifies.
When a match is found, I want to copy the whole row to the first
worksheet.

The code I developped -and which is not working- is written below.
Take into consideration that the code does start in the appropriate

cell,
but that this part of the code is outside this sub.

Private Sub Check_02()
'Check Role
x2 = Worksheets("Front").Range("txtRole").Value
Do Until IsEmpty(ActiveCell)
If Application.Proper(ActiveCell.Offset(0, 4).Value) Like
Application.Proper(x2) Then
ActiveCell.EntireRow.Copy WF.Range("B20").Offset(i, -1)
i = i + 1
j = j + 1
End If
ActiveCell.Offset(1, 0).Select
Loop
End Sub

---

What must I change so that I can check how many cells qualify.
Do I use the like operator right or do I have to do this differently.

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
Text "comparison" operator for "contains" used in an "IF" Function Pawaso Excel Worksheet Functions 4 April 4th 23 11:35 AM
Comparison Operator "" NOT "=" monir Excel Discussion (Misc queries) 4 October 22nd 07 02:42 AM
Is it possible to apply IF's to "operator" result.. nastech Excel Discussion (Misc queries) 3 August 11th 06 02:12 PM
program stuck at "Save Cancelled by Operator" MainelyPat Excel Discussion (Misc queries) 3 April 20th 06 06:23 PM
Excel no longer allows new formulas with division "/" operator SA Excel Programming 1 November 1st 03 07:07 AM


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