userform help

rhino4eva

Active Member
Joined
Apr 1, 2009
Messages
262
Office Version
  1. 2010
Platform
  1. Windows
I have a 2 sheet workbook
sheet1 has 2 columns with the labels doctors and email in the top row
each doctor has one email
sheet 2 is a sort of a pre-arranged stationary that I need to add the doctors name and email to before they print out

I have been able to create a userform with 2 comboboxes for name and email which fills the selected name and email into the correct cells on the second sheet

however I would like to drop the second combobox on the userform and somehow link the name chosen in the userform to the correct email

would be grateful for assistance please
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
I feel like i'm missing something here. Is there anything stopping you from using vlookup in your code to get the email associated with comboBox1's value?
 
Upvote 0
Why do you think you need to use a UserForm?

Why not double click a cell on sheet(1) which will do exactly what you want.

Put Doctor names in Sheet(1) Column(A)
Put Doctor Email address in Sheet(1) Column (B)

Double click on Doctor name and then this script will put Doctor name in Sheet(2) Range("F6")
And put Doctors Email address in Sheet(2).Range("H8")

Modify this to your needs.

This is an auto sheet event script
Your Workbook must be Macro enabled
To install this code:
Right-click on the sheet tab
Select View Code from the pop-up context menu
Paste the code in the VBA edit window

Put this script in Sheet(1)

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'Modified  4/4/2019  2:52:06 AM  EDT
If Target.Column = 1 Then
Cancel = True
Sheets(2).Range("F6").Value = Target.Value
Sheets(2).Range("H8").Value = Target.Offset(, 1).Value
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,209
Members
453,023
Latest member
alabaz

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top