RockandGrohl
Well-known Member
- Joined
- Aug 1, 2018
- Messages
- 790
- Office Version
- 365
- Platform
- Windows
Hi everyone.
This is an infamous problem at my work where people just don't give a F about making sure data is input correctly.
We have options that disclose the ticket that people bought on a show or attraction in London, and there are any number of ways they can be input. For example:
As you can see it's many, many different ways to say this is a ticket for a product which is "Tutankhamun, Treasures of the Golden Pharoah"
In worksheet F, I have a list of the options in column K, and I want the product name placed in column L.
In worksheet Tr, I have a list of the products we sell in column B and a list of the keywords in column C. For example:
Most of the time, the keyword will just be one single word, but where there's multiple it's because I want to catch out where people are using shorthand names etc.
So far, this is what my code does:
So I'm holding each of the keywords as the key, and then scanning down the list and seeing if anything matches.
Problem is when I have multiple keywords, I need to get these split out somehow.
Does anyone know how I could search for "Tut", then "Tutankhamun", or only one if there is one keyword, or three, etc?
Thank you!
This is an infamous problem at my work where people just don't give a F about making sure data is input correctly.
We have options that disclose the ticket that people bought on a show or attraction in London, and there are any number of ways they can be input. For example:
King Tut - Senior Citizen 55yrs + admission
Tut Adult Admission
Adult Tutankhamun Entry Ticket
Tut Senior Citizen 55yrs + admission
Tut Senior Citizen 55yrs + admission
King Tut Senior Citizen 55yrs + Admission
Tut Senior Citizen 55yrs + admission
Tut Senior Citizen 55yrs + admission
King Tut - Senior Citizen 55yrs + admission
King Tut - Adult
King Tut - Senior Citizen 55yrs + Admission
King Tut - Adult Admission
As you can see it's many, many different ways to say this is a ticket for a product which is "Tutankhamun, Treasures of the Golden Pharoah"
In worksheet F, I have a list of the options in column K, and I want the product name placed in column L.
In worksheet Tr, I have a list of the products we sell in column B and a list of the keywords in column C. For example:
|
Most of the time, the keyword will just be one single word, but where there's multiple it's because I want to catch out where people are using shorthand names etc.
So far, this is what my code does:
VBA Code:
Sub Create_Click()
Dim WB As Workbook
Dim Lastrow, LastrowTR As Long
Dim Rng, cl As Range
Application.ScreenUpdating = False
Set F = Worksheets("Front")
Set Tr = Worksheets("Translation")
F.Range("A3").Activate
Tr.Activate
Range("C2").Activate
Do Until Cells(ActiveCell.Row, "A").Value = ""
Tr.Activate
Key = Cells(ActiveCell.Row, "C").Value
Tnam = Cells(ActiveCell.Row, "B").Value
F.Activate
Do Until Cells(ActiveCell.Row, "A").Value = ""
If UCase(Cells(ActiveCell.Row, "K").Value) Like UCase("*" & Key & "*") Then
Cells(ActiveCell.Row, "L").Value = Tnam
End If
ActiveCell.Offset(1, 0).Activate
Loop
Range("A3").Activate
Tr.Activate
ActiveCell.Offset(1, 0).Activate
Loop
Application.ScreenUpdating = True
End Sub
So I'm holding each of the keywords as the key, and then scanning down the list and seeing if anything matches.
Problem is when I have multiple keywords, I need to get these split out somehow.
Does anyone know how I could search for "Tut", then "Tutankhamun", or only one if there is one keyword, or three, etc?
Thank you!