Sub New()
If Sheets("Mo D").Range("O1").Value = 1 Then
Sheets("Import").Select
Application.ScreenUpdating = False
Sheets("Import").Range("D3:D5").Copy
Sheets("Import").Range("E3:E5").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Sheets("Import").Range("D10:D19").Copy
Sheets("Import").Range("E10:E19").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Sheets("Import").Range("D24:D41").Copy
Sheets("Import").Range("E24:E41").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Sheets("Import").Range("D44:D61").Copy
Sheets("Import").Range("E44:E61").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End If
End Sub
I always get this error in the first line (If Sheets ..................).
The value of O1 is the number of the week.
In the complete script, the "End If" is coming after 52 x Else If.
I used this method several times before without any problem.
If Sheets("Mo D").Range("O1").Value = 1 Then
Sheets("Import").Select
Application.ScreenUpdating = False
Sheets("Import").Range("D3:D5").Copy
Sheets("Import").Range("E3:E5").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Sheets("Import").Range("D10:D19").Copy
Sheets("Import").Range("E10:E19").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Sheets("Import").Range("D24:D41").Copy
Sheets("Import").Range("E24:E41").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Sheets("Import").Range("D44:D61").Copy
Sheets("Import").Range("E44:E61").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End If
End Sub
I always get this error in the first line (If Sheets ..................).
The value of O1 is the number of the week.
In the complete script, the "End If" is coming after 52 x Else If.
I used this method several times before without any problem.