VBA Zahk mit Text (1 von 2) etc
07.12.2019 20:53:20
2)
eine besteimmte bereich wird untereinander kopiert, dann wird an hand der Anzahl der Kopieen (Zelle G3) ein zähler gesetzt.
1
2
3
etc
codezeile .Cells((ii * 6) + 6, 1).Value = ii + 1
ich möchte aber gerne anhand der kopieen eien ergänzung mit Text
also 4 Kopienen:
1 von 4
2 von 4
3 von 4
4 von 4
CODE
Option Explicit
Sub Kopieren_Print()
Dim rngVor As Range, lngZ As Long, lngS As Long, rngR As Range, ii As Long
Application.ScreenUpdating = False
With Sheets("Eingabe_Etikett")
Set rngVor = .Range("A1:E6")
lngS = rngVor.Columns.Count
lngZ = rngVor.Rows.Count * .Range("G3").Value
End With
With Sheets("Etikett_print").Range("A1").Resize(lngZ, lngS)
.EntireColumn.Clear ' löschen
rngVor.Copy ' kopieren
.PasteSpecial xlPasteValues
.PasteSpecial xlPasteFormats
.PasteSpecial xlPasteColumnWidths
.Cells.Interior.ColorIndex = xlNone
Application.CutCopyMode = False
For lngZ = 1 To rngVor.Rows.Count ' Zeilenhöhen
Set rngR = .Rows(lngZ)
For ii = 1 To Sheets("Eingabe_Etikett").Range("G3").Value - 1
.Cells((ii * 6) + 6, 1).Value = ii + 1
Set rngR = Union(rngR, .Rows(lngZ + ii * rngVor.Rows.Count))
Next ii
rngR.RowHeight = rngVor.Rows(lngZ).RowHeight
Next lngZ
End With
beste dank im Voraus
Hans