Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Need to enter 2 initials in a Combo box to populate User form

Posted on 2015-02-10
5
Medium Priority
?
66 Views
Last Modified: 2015-02-10
I am using this code to auto populate a user form.  I only takes one initial before it auto pops the form.  I would like to enter both as I have several employees with the same first initial

Private Sub ComboBox1_Change() 'auto pop by initials
Dim idx As Long

    idx = ComboBox1.ListIndex

    If idx <> -1 Then

        With Sheets("EmployeeName")
            TxtFname.Value = .Range("B" & idx + 2).Value 'fname
           
            TxtLName.Value = .Range("C" & idx + 2).Value 'lastname
           
            TxtStatus.Value = .Range("F" & idx + 2).Value 'status
           
            TxtHDept.Value = .Range("D" & idx + 2).Value 'HDept
           
            TxtUPH.Value = .Range("G" & idx + 2).Value 'UPH
           
      End With
       
    End If

    'new
    CB2FunctionCode.SetFocus
   
End Sub
0
Comment
Question by:bjfulkerson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40601094
Your code should be in the Click event rather than the Change event. That way it will execute when the user makes his selection.
0
 

Author Comment

by:bjfulkerson
ID: 40601116
Click event for Combo Box 1?
0
 
LVL 49

Accepted Solution

by:
Martin Liss earned 2000 total points
ID: 40601214
Yes.

If that doesn't work then please attach your workbook, or an obfuscated one if the data is sensitive.
0
 

Author Closing Comment

by:bjfulkerson
ID: 40601398
Martin,
You have been very helpful!

Cheers,
Jody
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 40601413
You're welcome and I'm glad I was able to help.

In my profile you'll find links to some articles I've written that may interest you.
Marty - MVP 2009 to 2014
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question