![]() |
Populating combox with worksheet names
Hi
I'm using the following to populate a combobox on a worksheet with the names of all the worksheets in the workbook:- Dim ws As Integer With frmMenu.cbStartUpWorksheet For ws = 1 To Sheets.Count ..AddItem Sheets(ws).Name Next End With My question is I have one worksheet that is veryhidden and I dont want it to show in the combobox. How do I do this? Cheers |
Populating combox with worksheet names
Use the .Visible property which list out xlSheetHidden, xlSheetVeryHidden and
xlSheetVisible.... Private Sub CommandButton1_Click() Dim ws As Worksheet With frmMenu.cbStartUpWorksheet For Each ws In Worksheets If ws.Visible < xlSheetVeryHidden Then .AddItem ws.Name Next End With End Sub -- Jacob (MVP - Excel) "Martin Parker" wrote: Hi I'm using the following to populate a combobox on a worksheet with the names of all the worksheets in the workbook:- Dim ws As Integer With frmMenu.cbStartUpWorksheet For ws = 1 To Sheets.Count .AddItem Sheets(ws).Name Next End With My question is I have one worksheet that is veryhidden and I dont want it to show in the combobox. How do I do this? Cheers |
Populating combox with worksheet names
Thank you Jacob, worked great. I have slightly amended to code to only load
visible worksheets into the combobox. Cheers Martin "Jacob Skaria" wrote: Use the .Visible property which list out xlSheetHidden, xlSheetVeryHidden and xlSheetVisible.... Private Sub CommandButton1_Click() Dim ws As Worksheet With frmMenu.cbStartUpWorksheet For Each ws In Worksheets If ws.Visible < xlSheetVeryHidden Then .AddItem ws.Name Next End With End Sub -- Jacob (MVP - Excel) "Martin Parker" wrote: Hi I'm using the following to populate a combobox on a worksheet with the names of all the worksheets in the workbook:- Dim ws As Integer With frmMenu.cbStartUpWorksheet For ws = 1 To Sheets.Count .AddItem Sheets(ws).Name Next End With My question is I have one worksheet that is veryhidden and I dont want it to show in the combobox. How do I do this? Cheers |
All times are GMT +1. The time now is 03:45 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com