Doflamingo
Board Regular
- Joined
- Apr 16, 2019
- Messages
- 238
Hi all,
Imagine I have a combobox from a userform that allows me to navigate through a workbook with many sheets -dozens of dozens-
I would like to know why the code of the userform initialize does not add the name of the sheet to the combobox when a new one is created
Current code
I have a macro
And the new sheet created appear in the listbox only if it follows that format Feuille002 or Feuille003 etc.
But I would like if I create a sheet called ''blabla '' appears in the combobox also ... because currently it does not work if I don't follow the specific format above
Any idea ?
Imagine I have a combobox from a userform that allows me to navigate through a workbook with many sheets -dozens of dozens-
I would like to know why the code of the userform initialize does not add the name of the sheet to the combobox when a new one is created
Current code
Code:
Private Sub UserForm_Initialize()
For Each s In ActiveWorkbook.Sheets
Me.ComboBox1.AddItem s.Name
Next s
Dim temp()
For i = 1 To Sheets.Count
ReDim Preserve temp(1 To i)
temp(i) = Sheets(i).Name
Next i
n = UBound(temp)
Call Tri(temp, 1, n)
Me.ComboBox1.List = temp
Me.ComboBox1.ListIndex = 0
End Sub
I have a macro
Code:
Sub essai()
For i = 2 To Sheets.Count
Sheets(i).Name = Format(i, "Feuille000")
Next i
End Sub
And the new sheet created appear in the listbox only if it follows that format Feuille002 or Feuille003 etc.
But I would like if I create a sheet called ''blabla '' appears in the combobox also ... because currently it does not work if I don't follow the specific format above
Any idea ?