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

Patriot2879

Well-known Member
Joined
Feb 1, 2018
Messages
1,227
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:
Hi. Ok i understand. Please advise me how I can send you a screenshot?
 
Upvote 0

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
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
wow that is amazing and works fantastic thank you so much for your help so much appreciated.
 
Upvote 0

Forum statistics

Threads
1,214,978
Messages
6,122,545
Members
449,089
Latest member
davidcom

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