Ich habe mir ein Makro zusammengebastelt das auch funktioniert aber eine zeile macht mir Kopfzerbrechen
Rows("Cells(varPB - 1):Cells(varPB + 3)").Insert
mit dieser zeile möchte ich die spalte varPB-1 um drei cellen nach unten verschieben aber irgentetwas mache ich falsch aber was ?
Ich hoffe meine beschreibung reicht euch
MfG
Ralf
Sub AutoForm1_BeiKlick()
Dim varPB As Variant
Dim iPage As Integer, iRowL As Integer
iRowL = Cells(Rows.Count, 1).End(xlUp).Row
iPage = 1
Do While IsError(varPB) = False
varPB = ExecuteExcel4Macro("INDEX(GET.DOCUMENT(64)," & iPage & ")")
If IsError(varPB) Then
Exit Sub
Else
Rows("Cells(varPB - 1):Cells(varPB + 3)").Insert
Range(Cells(varPB - 1, 5), Cells(varPB - 1, 6)).Select
With Selection
.MergeCells = True
End With
Cells(varPB - 1, 4) = "Übertrag"
Cells(varPB - 1, 5) = Application.Sum(Range(Cells(1, 6), _
Cells(varPB - 1, 6)))
Range(Cells(varPB + 1, 5), Cells(varPB + 1, 6)).Select
With Selection
.MergeCells = True
End With
Cells(varPB + 1, 4) = "Übertrag"
Cells(varPB + 1, 5) = Application.Sum(Range(Cells(1, 6), _
Cells(varPB - 1, 6)))
End If
iPage = iPage + 1
Loop
End Sub