brendalpzm
Board Regular
- Joined
- Oct 3, 2022
- Messages
- 59
- Office Version
- 365
- 2021
- 2019
- 2016
- Platform
- Windows
Hello everyone,
I have this issue that I've been struguling with for 2 days.
I have an activex combo box called EmpresaCB which is located in a sheet called "Registro", the thing is that this combo box has to be populated with information that is located in a different sheet called "DB"
This information is dynamic since it changes according to a filter/unique formula everytime someone inputs data in a raw data base. This information starts from the cell A2 in the "DB" sheet.
I have a VBA code that works well if the data base is in the same sheet, this is the code:
The thing is that... the data base is in a different sheet, so I want to know what should I add to this code in order for it to work.
If you can help me... thanks...
I have this issue that I've been struguling with for 2 days.
I have an activex combo box called EmpresaCB which is located in a sheet called "Registro", the thing is that this combo box has to be populated with information that is located in a different sheet called "DB"
This information is dynamic since it changes according to a filter/unique formula everytime someone inputs data in a raw data base. This information starts from the cell A2 in the "DB" sheet.
I have a VBA code that works well if the data base is in the same sheet, this is the code:
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim c As Range, Temp As String
Temp = EmpresaCB.Value
EmpresaCB.Clear
For Each c In Range(Range("A2"), Range("A" & Rows.Count).End(xlUp))
If c.Value <> vbNullString Then EmpresaCB.AddItem c.Value
Next c
EmpresaCB.Value = Temp
End Sub
The thing is that... the data base is in a different sheet, so I want to know what should I add to this code in order for it to work.
If you can help me... thanks...