Excel: For Each Loop and Case statement


Hello to you all, I have this code that i am using to populate my combobox when the form initializes. I want to add a new combobox so that in that box i will have the words "one", "two", "three". Then when i select any of those words from the ccombbox, i want only certain sheets to show in the list in the combobox1. How do i code it? Please help me out with this. Thanks Kelly


Private Sub UserForm_Initialize()
         Dim ws As Worksheet
                 For Each ws In Worksheets
                           Select Case ws.CodeName
                                      Case "Sheet2"
                                      Case Else
                            End Select
                  Next ws
End Sub


This question generated 12 answers. To proceed to the answers, click here.

This thread is current as of May 28, 2017.


For more resources for Microsoft Excel