LearnMeExcel
Well-known Member
- Joined
- Aug 11, 2009
- Messages
- 746
- Office Version
- 365
- 2021
- Platform
- Windows
hi
i add combobox in my sheets
i want to add the sheets name to Combobox
i wrote this code
but the problem every time i click the combobox the sheets name repeat,for example
first time the result
Sheet 1
Sheet 2
Sheet 3
the second time
Sheet 1
Sheet 2
Sheet 3
Sheet 1
Sheet 2
Sheet 3
how i can solve it
i add combobox in my sheets
i want to add the sheets name to Combobox
i wrote this code
Code:
Private Sub ComboBox1_GotFocus()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "Main" Then
ComboBox1.AddItem ws.Name
End If
Next ws
End Sub
first time the result
Sheet 1
Sheet 2
Sheet 3
the second time
Sheet 1
Sheet 2
Sheet 3
Sheet 1
Sheet 2
Sheet 3
how i can solve it