breynolds0431
Active Member
- Joined
- Feb 15, 2013
- Messages
- 303
- Office Version
- 365
- 2016
- Platform
- Windows
hello. trying to add sheet names to a userform combobox that are only visible, are not named "Start", and do not include a hyphen in the name.
I've tried the following, but that still adds all visible sheets that are not named "Start". If I change the second
Any help on how to only add visible sheets that are not named Start and do not include a hyphen in the name?
I've tried the following, but that still adds all visible sheets that are not named "Start". If I change the second
And
to an Or
, it loads all hidden sheets.Any help on how to only add visible sheets that are not named Start and do not include a hyphen in the name?
VBA Code:
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Sheets
If ws.Visible = True And ws.Name <> "Start" And Not InStr(ws.Name, "-") Then cboSheets.AddItem ws.Name
Next