Specific Cell Loaded into a Specific Userform Textbox

I'm creating a form and need to have specific cell copied to an excel userform textbox when the userform is opened.  Main_Form.xlsm
Sara HedtlerInsurance DirectorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Intersect(Target, Range("D1:G16").CurrentRegion) Is Nothing Then Exit Sub
    
    With Main_Form
      '  .txtAmsID = Cells("D15")
        'Main_Form.txtAmsID = Cells(Rows.Cells, "D15")
        .txtAmsID = Sheets("Sheet2").Cells(Target.Row, "D")
    Main_Form.Show
    End With
End Sub

Open in new window

0
Martin LissOlder than dirtCommented:
Actually if you want to do it when you open the userform then see line 27. But to do that you'll need to delete the complete Worksheet_SelectionChange event because they conflict.
Private Sub UserForm_Initialize()
    With Me
        cboBusinessType.List = Array("INDIVIDUAL", "LLC", "INC.", "DBA", "LLP", "OTHER")
        cboStatus.List = Array("NEW BUSINESS", "PROSPECT", "RENEWAL", "ENDORSEMENT", "REWRITE", "REVIEW")
        cboAgency.List = Array("FAKE AGENCY")
        cboProducer.List = Array("FAKE AGENT")
        cboCSRAssigned.List = Array("FAKE CSR")
        'cboLocationNo.List = Array("1", "2", "3", "4", "5", "MORE THAN 5")
        'cboNaicLookUp.List = Range("Naic_LookUp").Value
        'cboStateList1.List = Array("AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY")
        'cboStateList2.List = Array("AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY")
        'cboStateList3.List = Array("AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY")
        'cboStateList4.List = Array("AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY")
        'cboStateList5.List = Array("AL", "AK", "AZ", "AR", "CA", "CO", "CT", "DE", "FL", "GA", "HI", "ID", "IL", "IN", "IA", "KS", "KY", "LA", "ME", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM", "NY", "NC", "ND", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WV", "WI", "WY")
        'cboBusinessType.ListIndex = -1
        'cboLocationNo.ListIndex = -1
        'cboNaicLookUp.ListIndex = -1
        'cboStatus.ListIndex = -1
        cboAgency.ListIndex = -1
        cboProducer.ListIndex = -1
        cboCSRAssigned.ListIndex = -1
        'cboStateList1.ListIndex = -1
        'cboStateList2.ListIndex = -1
        'cboStateList3.ListIndex = -1
        'cboStateList4.ListIndex = -1
        'cboStateList5.ListIndex = -1
        txtBusinessName = Sheets("Sheet2").Range("D1")
    End With
End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sara HedtlerInsurance DirectorAuthor Commented:
Thank you so much, that is exactly what I was trying to do.
0
Martin LissOlder than dirtCommented:
You’re welcome and I’m glad I was able to help.

If you expand the “Full Biography” section of my profile you’ll find links to some articles I’ve written that may interest you.

Marty - Microsoft MVP 2009 to 2017
              Experts Exchange Most Valuable Expert (MVE) 2015, 2017
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2017
              Experts Exchange Top Expert VBA (current)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
userforms

From novice to tech pro — start learning today.