This is my code to copypicture a template from a worksheet, and paste them below each other, so they don't overlap. The code with teller is for counting how many templates he need to paste, because for each subject i need a template. But like , i need 3 templates, he is doing everything like it should be but by the third template he is don't stop, he is overlapping the third pictures the whole time and it don't stops. I tried already so many new macro's but i don't find a solution for this.
Thank you for helping
Sub kwnie2()
Dim bcell As Range
Dim teller As Integer
teller = 0
Sheets("SETUP").Activate
Range("begincellll").Select
ActiveCell = ActiveCell.Offset(1, 1)
For Each bcell In Range("Bereik")
If IsEmpty(bcell) Then
'bcell = blank
Else: 'bcell = 1
teller = teller + 1
Sheets("Stuktekening gordingen").Activate
Range("Print_Area").CopyPicture
Sheets("Stuktekeningtemplate").Activate
FinalRow = Cells(Rows.Count, 1).End(xlUp).Row
For x = 1 To FinalRow
ThisValue = Cells(x, 1).Value
If ThisValue = "" Then
'teller = teller + 1
ActiveCell.Value = "Template"
ActiveSheet.PasteSpecial
ElseIf ThisValue <> "" Then
ActiveCell.Offset(50, 0).Select
'teller = teller + 1
ActiveCell.Value = "Template"
NextRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
Cells(NextRow, 1).Select
ActiveSheet.PasteSpecial
End If
Next x
End If
Next bcell
Sheets("SETUP").Activate
Range("begincellll").Select
ActiveCell.FormulaR1C1 = teller
End Sub
Thank you for helping
Sub kwnie2()
Dim bcell As Range
Dim teller As Integer
teller = 0
Sheets("SETUP").Activate
Range("begincellll").Select
ActiveCell = ActiveCell.Offset(1, 1)
For Each bcell In Range("Bereik")
If IsEmpty(bcell) Then
'bcell = blank
Else: 'bcell = 1
teller = teller + 1
Sheets("Stuktekening gordingen").Activate
Range("Print_Area").CopyPicture
Sheets("Stuktekeningtemplate").Activate
FinalRow = Cells(Rows.Count, 1).End(xlUp).Row
For x = 1 To FinalRow
ThisValue = Cells(x, 1).Value
If ThisValue = "" Then
'teller = teller + 1
ActiveCell.Value = "Template"
ActiveSheet.PasteSpecial
ElseIf ThisValue <> "" Then
ActiveCell.Offset(50, 0).Select
'teller = teller + 1
ActiveCell.Value = "Template"
NextRow = Cells(Rows.Count, 1).End(xlUp).Row + 1
Cells(NextRow, 1).Select
ActiveSheet.PasteSpecial
End If
Next x
End If
Next bcell
Sheets("SETUP").Activate
Range("begincellll").Select
ActiveCell.FormulaR1C1 = teller
End Sub