I tried to run this code to fill column headers in a comboBox, but it gives me an error!!.
Note: data is in sheet1
ComboBox1 is in sheet2
the code excutes when workbook opens.
when I use this code it works:
For a reason, I want to use
Sheet1.Range(Cells(1, 1), Cells(1, 8))
instead of
Sheet1.Range("A1", "H1")
Thank you.
Code:
Dim Cell As Range
For Each Cell In Sheet1.Range(Cells(1, 1), Cells(1, 8)) S
heet2.ComboBox1.AddItem (Cell.Value)
Next Cell
Note: data is in sheet1
ComboBox1 is in sheet2
the code excutes when workbook opens.
when I use this code it works:
Code:
Dim Cell As Range
For Each Cell In Sheet1.Range("A1", "H1")
Sheet2.ComboBox1.AddItem (Cell.Value)
Next Cell
For a reason, I want to use
Sheet1.Range(Cells(1, 1), Cells(1, 8))
instead of
Sheet1.Range("A1", "H1")
Thank you.