hab dochnoch eine Frage.
Ich lasse die Zeilen zählen und per MsgBox als auch in einer Zelle ausgeben.
Nun möchte ich das ab der Spalte A2 eine fortlaufende Nummer ausgegeben wird so lange in den Zeilen etwas drinsteht.
Anbei das jetzige Makro:
Sub VisibleRowsCount()
Dim iRows As Integer, iRowL As Integer, iColL As Integer, iCounter As Integer
iColL = Cells(1, 256).End(xlToLeft).Column
iRowL = Cells(Rows.Count, 1).End(xlUp).Row
For iRow = 1 To iRowL
If Rows(iRow).Hidden = False Then
If WorksheetFunction.CountA(Rows(iRow)) > 0 Then
iCounter = iCounter + 1
End If
End If
Next iRow
MsgBox iCounter - 1
Columns("A:A").Select
Selection.Insert Shift:=xlToRight
Range("B1:D1").Select
Selection.Font.Bold = True
Selection.Font.Underline = xlUnderlineStyleSingle
Range("E1").Select
ActiveCell.FormulaR1C1 = "Anzahl der Datensätze"
Columns("E:E").EntireColumn.AutoFit
Range("F1").Select
With Selection
.HorizontalAlignment = xlLeft
End With
Cells(1, 6) = iCounter - 1
With ActiveSheet.PageSetup
.CenterHeader = "&""Arial,Fett""&14Alle BG-Mitglieder "
.RightHeader = "&D - &T Uhr"
.CenterFooter = "&F\&A"
.RightFooter = "Seite &P von &N"
.PrintTitleRows = "$1:$2"
.CenterHorizontally = True
.Zoom = 60
.FitToPagesWide = 1
.FitToPagesTall = 1
End With
Range("A1").Select
ActiveWindow.SelectedSheets.PrintPreview
If (MsgBox("Soll das aktuelle Tabellenblatt - Alle BG Mitglieder - jetzt gedruckt werden?.", vbQuestion + vbYesNo + vbDefaultButton2, "Druckausgabe") = vbYes) Then
Application.Dialogs(xlDialogPrint).Show
Else
Range("A1").Select
End If
End Sub
Vielen Dank für eure Mühe.
Gruß
Martin