Range Method gives runtime 1004 error

JeffGrant

Well-known Member
Joined
Apr 7, 2021
Messages
558
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I have a strange one. With this code, if I change sheet1.cells(4,15).value to sheet1.range("O4").value i get runtime 1004 error.

However, i use the range method in other modules and even other procedures in the same module without any errors at. In fact this is the only time that I am being forced to use the cells method. I use the range method everywhere else.

I would appreciate any suggestion as to why this one is so weird.

Thanks in advance


VBA Code:
    If Sheet1.Cells(4, 15).Value <= 3 And MonitorOnly = "Yes" Then
        frmSelections31.Show
    ElseIf Sheet1.Cells(4, 15).Value <= 3 Then
        frmSelections3.Show
    ElseIf Sheet1.Cells(4, 15).Value <= 4 And MonitorOnly = "Yes" Then
        frmSelections41.Show
    ElseIf Sheet1.Cells(4, 15).Value = 4 Then
        frmSelections4.Show
    ElseIf Sheet1.Cells(4, 15).Value <= 5 And MonitorOnly = "Yes" Then 
        frmSelections51.Show
    Else:
        frmSelections5.Show
    End If
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Can you post the code using the range method (not a retyped line, a copy paste of the actual code) please.
 
Upvote 0
With this code, if I change sheet1.cells(4,15).value to sheet1.range("O4").value i get runtime 1004 error.
I get that message if I 'accidentally' use zero instead of O. Are you sure that didn't happen to you?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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