Michael2008
New Member
- Joined
- Feb 11, 2014
- Messages
- 1
Hi guys,
I have a worksheet with following values:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]Shorts
[/TD]
[TD]75
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]Pants
[/TD]
[TD]25
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]Socks
[/TD]
[TD]34
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD]Shirt
[/TD]
[TD]10
[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Also I have a Userform with 2 ComboBoxes named "ComboBox1" and "ComboBox2". Values in ComboBox1 is "Pull my pants", "Eat my shorts", "Socks for everyone".
What I would like to do is to search though column A and look for any of these textstrings in my selection in ComboBox1 and return the value from column B in column C.
Example: "Pull my pants" is selected in ComboBox1 then the value "pants" should be found in column A and value in column B (25) should be entered in cell C2.
Does this make sense?
I am fairly new to VBA and have spend hours searching Google and found some formulas like InStr and VLookup. My problem is that I am not sure if these statements will do the job and how to combine them.
Any help and guidance is appreciated.
Thanks in advance
Brgds
Michael
I have a worksheet with following values:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A
[/TD]
[TD]B
[/TD]
[TD]C
[/TD]
[/TR]
[TR]
[TD]1
[/TD]
[TD]Shorts
[/TD]
[TD]75
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2
[/TD]
[TD]Pants
[/TD]
[TD]25
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD]Socks
[/TD]
[TD]34
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4
[/TD]
[TD]Shirt
[/TD]
[TD]10
[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
Also I have a Userform with 2 ComboBoxes named "ComboBox1" and "ComboBox2". Values in ComboBox1 is "Pull my pants", "Eat my shorts", "Socks for everyone".
What I would like to do is to search though column A and look for any of these textstrings in my selection in ComboBox1 and return the value from column B in column C.
Example: "Pull my pants" is selected in ComboBox1 then the value "pants" should be found in column A and value in column B (25) should be entered in cell C2.
Does this make sense?
I am fairly new to VBA and have spend hours searching Google and found some formulas like InStr and VLookup. My problem is that I am not sure if these statements will do the job and how to combine them.
Any help and guidance is appreciated.
Thanks in advance
Brgds
Michael