userform help
Results 1 to 3 of 3

Thread: userform help
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular rhino4eva's Avatar
    Join Date
    Apr 2009
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)

    Default userform help

    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

  2. #2
    Board Regular
    Join Date
    Dec 2009
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)

    Default Re: userform help

    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?
    My favorite Excel Add-in:= Nutilities

  3. #3
    Board Regular My Aswer Is This's Avatar
    Join Date
    Jul 2014
    Post Thanks / Like
    28 Post(s)
    13 Thread(s)

    Default Re: userform help

    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)

    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
    Be sure and always test this script on sample data the first time you use this as to avoid any problems with your data. Always trying to learn more and help others where I can. I'm using Excel 2013.
    Patience please I’m not perfect yet. "Memories are forever"

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts