Hi Ryan,
Welcome to ExcelFox !!!
In a standard module
in the workbook moduleCode:Function GETSHEETS(ByRef ExceptShts As Variant) Dim n As Long, i As Long, j As Long, x, Shts() j = Worksheets.Count ReDim Shts(1 To j) For i = 1 To j x = Application.Match(Worksheets(i).Name, ExceptShts, 0) If IsError(x) Then n = n + 1 Shts(n) = Worksheets(i).Name End If Next If n Then ReDim Preserve Shts(1 To n) GETSHEETS = Shts End If End Function
and add the following lines in the cmdAdd_Click procedureCode:Private Sub Workbook_Open() Dim x x = GETSHEETS(Array("view")) Worksheets("view").ComboBox1.List = x End Sub
Code:Dim Idx As Long Idx = Me.ComboBox1.ListIndex If Idx = -1 Then MsgBox "Select database sheet", vbInformation Exit Sub End If Set ws = Worksheets(CStr(Me.ComboBox1.List(Idx)))




Reply With Quote

Bookmarks