PDA

View Full Version : Retrieve value based on selection



ish_baho
01-16-2017, 07:02 PM
Hi all,

relatively new to VBA and am working on a small project to create a form that once filled out and ran will create an e-mail to the appropriate people. I already know how to generate e-mails from a previous project and am looking for help to solve this particular problem.

I have 2 sheets. First sheet contains the ordering options and the second is a table of projects and associated vendors and relative numbers.

Sheet 2


Project Name
Project Number
Main Vendor
Vendor A
Vendor B
e-mail


Project 1
123
Vendor A
8j2s0f




Project 2
456
Vendor B

ms02jn4



Project 3
789
Vendor B

dimo29



-Column 3 states which vendor is used and in correct column a unique string is presented which I would like to extract for my email
-Columns 3, 4 & 5 are laid out this way because I also use Sheet 2 as a reference for doing other things. Otherwise I would just put the unique string in a cell in the row for that respective project.

Sheet 1 is still in the works but roughly looks like this....
Project Name: (data validation drop down)
Vendor: This is where I would like the vba code to automatically retrieve the appropriate vendor from Column 3 based on the Project Name selected above
String: Retrieve the corresponding string for project
Order: a list of things i will be ordering

There a few other things in the form but I have got them worked out for the most part.

Anything helps!

Thanks in advance.

Kenneth Hobs
01-16-2017, 07:22 PM
Welcome to the forum!

I suspect that a simple attached file might make it easier to help. Maybe it is simply?

MsgBox Selection.Offset(,2).value