exclude sheet from list of combobox on userform

Abdo

Board Regular
Joined
May 16, 2022
Messages
217
Office Version
  1. 2019
  2. 2010
Platform
  1. Windows
Hello
I try excluding specific sheet from combobox on userform but still continue showing
so when populate sheets names in combobox1 should ignore sheets "Home" totally
VBA Code:
dim ws as worksheet
If ComboBox1.Value = "" Then Exit Sub
If ws.Name <> "Home" Then
Set ws = Sheets(ComboBox1.Value)
End If
ws.Activate
I hope some body guide me the right way
thanks
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Hello
I try excluding specific sheet from combobox on userform but still continue showing
so when populate sheets names in combobox1 should ignore sheets "Home" totally
VBA Code:
dim ws as worksheet
If ComboBox1.Value = "" Then Exit Sub
If ws.Name <> "Home" Then
Set ws = Sheets(ComboBox1.Value)
End If
ws.Activate
I hope some body guide me the right way
thanks
Show me the script you're using to load the sheet names into the combobox
Why not have that script not add that sheet name to the userform combobox
 
Upvote 0
Show me the script you're using to load the sheet names into the combobox
I do in Private Sub ComboBox1_Change()

Why not have that script not add that sheet name to the userform combobox
I'm not sure if you understand me what I want !

I don't want show sheet"Home" in combobox1 .
 
Upvote 0
Yes I know you do not want Home in the combobox.
Show me the script your using that put Home into the combobox.
 
Upvote 0
I'm not sure what you want to see the in combobox ?!
 
Upvote 0
I try excluding specific sheet from combobox on userform but still continue showing
so when populate sheets names in combobox1 should ignore sheets "Home" totally
Maybe this:
VBA Code:
Dim ws As Worksheet
If ComboBox1.Value = "" Then Exit Sub
If UCase(ComboBox1.Value) <> UCase("Home") Then
Set ws = Sheets(ComboBox1.Value)
ws.Activate
End If
 
Upvote 0
Hi Akuini
I try with this
VBA Code:
Private Sub UserForm_Initialize()
Dim ws As Worksheet
For Each ws In Worksheets
If ComboBox1.Value = "" Then Exit Sub
If UCase(ComboBox1.Value) <> UCase("Home") Then
Set ws = Sheets(ComboBox1.Value)
ComboBox1.AddItem Sheets(ws).Name
ws.Activate
End If

Next ws
        
End Sub
but doesn't fill anything in combobox1 !
 
Upvote 0
If you want to load all the workbook sheet names into the combobox.
But want to exclude the sheet named "Home then try this script.
VBA Code:
Sub RectangleSingleCornerSnipped1_Click()
Dim i As Long
With ActiveSheet.ComboBox1
.Clear
For i = 1 To Sheets.Count
        If Sheets(i).Name <> "Home" Then .AddItem Sheets(i).Name
    Next
End With
End Sub
 
Upvote 0
If you want to load all the workbook sheet names into the combobox.
But want to exclude the sheet named "Home then try this script.
gives error object doesn't support this property
VBA Code:
With ActiveSheet.ComboBox1
 
Upvote 0
gives error object doesn't support this property
VBA Code:
With ActiveSheet.ComboBox1
Is your combobox an activex combobox and is it on the same sheet as your running this script from.

Thats why I asked earlier for you to show me the script which did put Home in the combobox but you did not show me your script.
Is the combobox named Combobox1?
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,304
Members
452,633
Latest member
DougMo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top