DanniiMarie
New Member
- Joined
- May 21, 2018
- Messages
- 30
- Office Version
- 365
- 2021
- 2019
- 2016
- 2013
- 2011
- 2010
- 2007
- 2003 or older
- Platform
- Windows
- MacOS
- Mobile
- Web
I want to search a cell for a string in a range. If one of the strings within the range is found, I want to use a vlookup to return a value from a grid. How would I do this with VBA?
Here is an example of what I want to do (I apologize in advance for the wonky formatting on the bottom grid):
VLOOKUP DATA:
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]If this string is found[/TD]
[TD]Use this Value[/TD]
[/TR]
[TR]
[TD]Decals[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Window POP[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]Planogram[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]Counter Card[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]Billboard[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]DL[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]WIN[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]WP[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]PLAN[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]CC[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]BB[/TD]
[TD]5[/TD]
[/TR]
</tbody>[/TABLE]
DATA TO SEARCH:
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Cells to Search[/TD]
[TD="align: center"]Returned Value[/TD]
[/TR]
[TR]
[TD]BB: 25% Off - code: 25OFF (qty: 3500)[/TD]
[TD="align: center"]5[/TD]
[/TR]
[TR]
[TD]Counter Card: Take One[/TD]
[TD="align: center"]4[/TD]
[/TR]
[TR]
[TD]Decals: $12-15 DEAL OF THE DAY[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD][TABLE="width: 310"]
<tbody>[TR="class: grid"]
[TD="width: 310"]Decals: $17/18/19 DEAL OF THE DAY[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD][TABLE="width: 310"]
<tbody>[TR="class: grid"]
[TD="width: 310"]Planogram[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD]BB: 25% Off - code: 25OFF (qty: 7000)[/TD]
[TD="align: center"]5[/TD]
[/TR]
[TR]
[TD][TABLE="width: 310"]
<tbody>[TR="class: grid"]
[TD="width: 310"]WP: AMAZING DEAL $11[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="align: center"]2[/TD]
[/TR]
</tbody>[/TABLE]
Here is an example of what I want to do (I apologize in advance for the wonky formatting on the bottom grid):
VLOOKUP DATA:
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]If this string is found[/TD]
[TD]Use this Value[/TD]
[/TR]
[TR]
[TD]Decals[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]Window POP[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]Planogram[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]Counter Card[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]Billboard[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]DL[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]WIN[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]WP[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]PLAN[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]CC[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]BB[/TD]
[TD]5[/TD]
[/TR]
</tbody>[/TABLE]
DATA TO SEARCH:
[TABLE="class: grid, width: 500, align: left"]
<tbody>[TR]
[TD]Cells to Search[/TD]
[TD="align: center"]Returned Value[/TD]
[/TR]
[TR]
[TD]BB: 25% Off - code: 25OFF (qty: 3500)[/TD]
[TD="align: center"]5[/TD]
[/TR]
[TR]
[TD]Counter Card: Take One[/TD]
[TD="align: center"]4[/TD]
[/TR]
[TR]
[TD]Decals: $12-15 DEAL OF THE DAY[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD][TABLE="width: 310"]
<tbody>[TR="class: grid"]
[TD="width: 310"]Decals: $17/18/19 DEAL OF THE DAY[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD][TABLE="width: 310"]
<tbody>[TR="class: grid"]
[TD="width: 310"]Planogram[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD]BB: 25% Off - code: 25OFF (qty: 7000)[/TD]
[TD="align: center"]5[/TD]
[/TR]
[TR]
[TD][TABLE="width: 310"]
<tbody>[TR="class: grid"]
[TD="width: 310"]WP: AMAZING DEAL $11[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD="align: center"]2[/TD]
[/TR]
</tbody>[/TABLE]