VBA error 40036 When checking value of cell

Octonet

New Member
Joined
Sep 5, 2020
Messages
27
Office Version
  1. 2019
Platform
  1. Windows
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.
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
First thing I would do is try renaming the procedure since 'New' is a word used within vba itself.
 
Upvote 0
Thanks for the reply Peter.
I tried renaming; but without succes :(
 
Upvote 0
In the VB Editor select Debug > Compile & fix any errors it comes up in.
That might help.
 
Upvote 0
Solution
Thanks Fluff; that has put me into the right direction. There was an error in another script.
It is solved now.
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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