ich möchte gerne alle Namen der sichtbaren mappen auslesen
und in einen Array übergeben, wie kann ich sowas anstellen ,
damit ich nicht immer die Namen schreiben muss(z.b.: Sheets(Array("Tabelle1", "Tabelle2", ....)).select ).
Gruß Jörg
Sub SelectAllVisibleSheets()
Dim arrSheets As String, i As Integer
For i = 1 To Worksheets.Count
If Worksheets(i).Visible Then
arrSheets = arrSheets & Worksheets(i).Name & ","
End If
Next
arrSheets = Left(arrSheets, Len(arrSheets) - 1)
Worksheets(Split(arrSheets, ",")).Select
End Sub
Sub drucke_pdf()
Dim wks As Worksheet
Dim sPrinter As String
Application.Dialogs(xlDialogPrinterSetup).Show
sPrinter = Application.ActivePrinter
For Each wks In Worksheets
If wks.Visible = True Then
ThisWorkbook.Sheets.Select
End If
Next
Sheets("Tabelle1").Activate
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:=sPrinter
End Sub
Sub TabTitel()
Rem liefert ein Variablenarray (Variant) _
mit Namen aller sichtbaren Blätter (j) _
pro geöffneter Arbeitsmappe (i)
Dim b As Workbook, s As Worksheet, _
t() As Variant, w() As Variant, _
i As Integer, j As Integer, _
m As Integer, n As Integer
m = Workbooks.Count - 1
Rem -1 wenn Index bei 0 beginnt
ReDim w(m)
For Each b In Workbooks
n = b.Sheets.Count
ReDim t(n)
j = 0: t(0) = b.Name
For Each s In b.Sheets
j = j + 1
If s.Visible Then
t(j) = s.Name
End If
Next s
w(i) = t
i = i + 1
Next b
MsgBox w(0)(1) & Chr(10) & w(0)(2), vbOKOnly, w(0)(0)
Rem MsgBox ist nur TestBsp - hier dann zentrale Ausgabe- _
bzw Ablageanweisungen für w(i)(j) einfügen!
End Sub