Nog een probleempje waar ik opeens tegenaan loop. Ik krijg namelijk de melding objectvariabele of blokvariabele with is niet ingesteld terwijl dezelfde formule het eerst wel deed. Het enige wat echt veranderd is, is dat er een paar tabbladen zijn verborgen sinds de vorige keer. Heb geprobeerd dezelfde macro uit te voeren met de tabbladen weer zichtbaar, maar wilde niet baten. Ik heb verder ook een aantal topics hierover gelezen in dit forum, maar wordt me niet echt veel duidelijker 
Hier staat de betreffende code:
Bij het rode gedeelte geeft de editor de foutmelding. Ik hoop dat iemand de fout ziet, ik kom er niet uit

Hier staat de betreffende code:
Code:
Private Sub CommandButtonVerwerknieuw_Click()
Dim iLC As Integer
Dim FindString As String
Dim rng As Range
Dim Lr As Long
If Application.WorksheetFunction.CountA(Range("A4:F4")) < 6 Then
MsgBox ("Niet volledig ingevuld"): Exit Sub
End If
FindString = Range("A4")
If Trim(FindString) <> "" Then
With Sheets("Voorraadscherm").Range("A29:A65536")
Set rng = .Find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlValues, _
lookat:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
MsgBox ("Productnummer bestaat al"): Exit Sub
Else
Lr = Worksheets("Data").Cells(Rows.Count, 1).End(xlUp).Row + 1
With Sheets("Data")
For iKol = 1 To 7
Sheets("Data").Cells(Lr, iKol) = Sheets("Nieuw product invoeren").Cells(4, iKol)
Next
Lr = Worksheets("Voorraadscherm").Cells(Rows.Count, 1).End(xlUp).Row + 1
With Sheets("Voorraadscherm")
.Cells(Lr, 1) = Sheets("Nieuw product invoeren").Cells(4, 1)
.Cells(Lr, 2) = Sheets("Nieuw product invoeren").Cells(4, 2)
.Cells(Lr, 3) = Sheets("Nieuw product invoeren").Cells(4, 5)
.Cells(Lr, 4) = Sheets("Nieuw product invoeren").Cells(4, 3)
.Cells(Lr, 5) = Sheets("Nieuw product invoeren").Cells(4, 8)
.Cells(Lr, 6) = Sheets("Nieuw product invoeren").Cells(4, 4)
End With
Lr = Worksheets("Inkoopscherm").Cells(Rows.Count, 1).End(xlUp).Row + 1
With Sheets("Inkoopscherm")
.Cells(Lr, 1) = Sheets("Nieuw product invoeren").Cells(4, 1)
.Cells(Lr, 2) = Sheets("Nieuw product invoeren").Cells(4, 2)
.Cells(Lr, 3) = Sheets("Nieuw product invoeren").Cells(4, 5)
.Cells(Lr, 4) = Sheets("Nieuw product invoeren").Cells(4, 3)
.Cells(Lr, 5) = Sheets("Nieuw product invoeren").Cells(4, 7)
.Cells(Lr, 6) = Sheets("Nieuw product invoeren").Cells(4, 8)
.Cells(Lr, 7) = Sheets("Nieuw product invoeren").Cells(4, 4)
End With
Sheets("Nieuw product invoeren").Range("A4:F4").ClearContents
Sheets("Nieuw product invoeren").Range("H4").ClearContents
Sheets("Nieuw product invoeren").Visible = False
NieuwVoorraadverloop
Sheets("Inkoopscherm").Select
End With
End If
End With
End If
End Sub
Code:
Sub NieuwVoorraadverloop()
Dim iLC As Integer
Sheets("Template").Visible = True
Sheets("Template").Columns("A:G").Copy
Sheets("Voorraadverloop").Select
[COLOR="Red"] iLC = Cells.Find(What:="*", SearchOrder:=xlByColumns, _
SearchDirection:=xlPrevious).Column[/COLOR]
Cells(1, iLC + 2).EntireColumn.Select
ActiveSheet.Paste
Sheets("Template").Visible = False
Sheets("Inkoopscherm").Select
Sheets("Inkoopscherm").Select
Cells(Cells.Rows.Count, "A").End(xlUp).Select
Selection.Copy
Sheets("Voorraadverloop").Select
ActiveCell.Offset(5, 0).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("A1").Select
End Sub
Bij het rode gedeelte geeft de editor de foutmelding. Ik hoop dat iemand de fout ziet, ik kom er niet uit
