How to auto update textbox1 with data from 2 different combo boxes?

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,259
Office Version
  1. 2010
Platform
  1. Windows
Hi Goodmorning, hope you can help me please with some VBA code please, I have a userform called ‘Userform6’, andin this I have a dropdown box which is named ‘ComboBox1’ which has a list ofwords for example, Stores, Late start, Sickness etc. Then I have another comboboxcalled ‘ComboBox2’ which has a list of people’s names, then I have a textboxcalled ‘TextBox1’ which is for postcode and I want this to automatically updatewhen stores is listed in the ComboBox1 and the name is highlighted in combobox2.
In sheet ’INDAY LISTS’ the stores postcodes are in row L2 to lastrow and the names are inrow D2 to last row.



I hope youcan help?
 
Last edited:

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Upvote 0
hi, I hope I have added the dropbox file correctly? hope you can help, thank you for your time.
 
Upvote 0
hi, I hope I have added the dropbox file correctly? hope you can help, thank you for your time.


Please, put the following to your code.

Code:
Private Sub ComboBox2_Change()
    Dim sh As Worksheet
    TextBox3.Value = ""
    If ComboBox2.ListIndex = -1 Then Exit Sub
    If ComboBox1 = "Stores" Then
        Set sh = Sheets("IN DAY LISTS")
        Set f = sh.Range("D:D").Find(ComboBox2.Value, LookIn:=xlValues, lookat:=xlWhole)
        If Not f Is Nothing Then
            TextBox3.Value = sh.Cells(f.Row, "I").Value
        End If
    End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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