VBA Excell question (macro)

Status
Not open for further replies.

sey

New Member
Joined
Apr 28, 2011
Messages
35
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
<!-- / message -->
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Status
Not open for further replies.

Forum statistics

Threads
1,224,518
Messages
6,179,254
Members
452,900
Latest member
LisaGo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top