populate headers on combobox (rowsource) and skip the others

abdo meghari

Active Member
Joined
Aug 3, 2021
Messages
465
Office Version
  1. 2019
Hi

I want populating headers in combobox on userform based on headers in row1 for sheet2 and skip any column contains header ITEM (should not populate any column contains header ITEM into combobox) with considering should populate automatically when add new header by insert new column into combobox .
this is what I want to modify it .
VBA Code:
Private Sub UserForm_Initialize()
Dim ws As Worksheet
Dim d As Object
Dim x

Set d = CreateObject("scripting.dictionary")
d.CompareMode = vbTextCompare
Set ws = Sheets("sheet2")
        For Each x In .Range("A1:D1" & .Cells(Rows.Count, "A").End(xlUp).Row).Value
          d(x) = Empty
        Next
Me.ComboBox1.List = d.Keys
End Sub
Thanks
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

Forum statistics

Threads
1,214,589
Messages
6,120,415
Members
448,960
Latest member
AKSMITH

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