Microsoft Office Tutorials and References
In Depth Information
ListBox Techniques
Figure 14-17: This dialog box lets the user activate a sheet.
Public OriginalSheet As Object
Private Sub UserForm_Initialize()
Dim SheetData() As String, Sht As Object
Dim ShtCnt As Integer, ShtNum As Integer, ListPos As Integer
Set OriginalSheet = ActiveSheet
ShtCnt = ActiveWorkbook.Sheets.Count
ReDim SheetData(1 To ShtCnt, 1 To 4)
ShtNum = 1
For Each Sht In ActiveWorkbook.Sheets
If Sht.Name = ActiveSheet.Name Then _
ListPos = ShtNum - 1
SheetData(ShtNum, 1) = Sht.Name
Select Case TypeName(Sht)
Case “Worksheet”
SheetData(ShtNum, 2) = “Sheet”
SheetData(ShtNum, 3) = _
Application.CountA(Sht.Cells)
Case “Chart”
SheetData(ShtNum, 2) = “Chart”
SheetData(ShtNum, 3) = “N/A”
Case “DialogSheet”
SheetData(ShtNum, 2) = “Dialog”
SheetData(ShtNum, 3) = ”N/A”
End Select
If Sht.Visible Then
SheetData(ShtNum, 4) = ”True”
Else
SheetData(ShtNum, 4) = ”False”
End If
 
Search JabSto ::




Custom Search