I can't seem to figure out why I keep getting and Run Time Error 13.
Can any one help.
Sub Batch_In()
Dim Num1 As Variant
Dim Bedrag As Variant
Dim BelegN As Variant
Dim Num2 As Variant
Dim Pastel As Variant
Dim BatchN As Variant
Dim Kolom As Variant
BatchN = "Opbrengs-Apr"
Kolom = 6
For Num1 = 2 To 1392
Sheets("Batch Lys 2011").Select
If Cells(Num1, 3).Value > 0 Then
Pastel = Cells(Num1, 1).Value
BelegN = Cells(Num1, 2).Value
Bedrag = Cells(Num1, Kolom).Value
Sheets("2011").Select
For Num2 = 5 To 25060
If Cells(Num2, 2).Value = Pastel Then
If Cells(Num2, 12).Value = BatchN Then
Cells(Num2, 17).Value = BelegN
Cells(Num2, 18).Value = Pastel
Cells(Num2, 19).Value = Bedrag
Cells(Num2, 17).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 15773696
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Sheets("Batch Lys 2011").Select
Cells(Num1, Kolom).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 15773696
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Else
End If
End If
Next Num2
End If
Next Num1
End Sub
Can any one help.
Sub Batch_In()
Dim Num1 As Variant
Dim Bedrag As Variant
Dim BelegN As Variant
Dim Num2 As Variant
Dim Pastel As Variant
Dim BatchN As Variant
Dim Kolom As Variant
BatchN = "Opbrengs-Apr"
Kolom = 6
For Num1 = 2 To 1392
Sheets("Batch Lys 2011").Select
If Cells(Num1, 3).Value > 0 Then
Pastel = Cells(Num1, 1).Value
BelegN = Cells(Num1, 2).Value
Bedrag = Cells(Num1, Kolom).Value
Sheets("2011").Select
For Num2 = 5 To 25060
If Cells(Num2, 2).Value = Pastel Then
If Cells(Num2, 12).Value = BatchN Then
Cells(Num2, 17).Value = BelegN
Cells(Num2, 18).Value = Pastel
Cells(Num2, 19).Value = Bedrag
Cells(Num2, 17).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 15773696
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Sheets("Batch Lys 2011").Select
Cells(Num1, Kolom).Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 15773696
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Else
End If
End If
Next Num2
End If
Next Num1
End Sub