Run-time error '1004': Method 'Range' of object '_Global' failed

Luke10101

New Member
Joined
Jul 16, 2014
Messages
25
Hello - I am trying to work out why I am receiving this error.

When I debug it - the bold and underlined line below is causing an error.

It may be worth mentioning that this works fine in a normal Macro enabled workbook. But once I upload the workbook to a collaborative tool, this error occurs upon opening.



Public previous As Double
Private Sub workbook_open()

If IsError(Range("E10")) Then
Range("E10").Select

Else

previous = Worksheets("Totals").Range("E10").Value
Worksheets("Totals").Range("AB1").Value = previous
Range("E10").Select

End If
End Sub
 
Last edited:

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Maybe it is a problem of the collaborative tool, maybe its version does not consider certain sentences.

Try :

Code:
If IsError(Range("E10")[COLOR=#0000ff].Value[/COLOR]) Then
 
Upvote 0
Hey - thanks for coming back to me.

I changed the code slightly based on your feedback and now the subsequent line is causing the same issue.

Again, no issues when the workbook is offline and the error only appears once uploaded to the collaborative tool.



Code:
Public previous As Double
Private Sub workbook_open()

If IsError(Worksheets("Totals").Range("E10").Value) Then
[U][B]Worksheets("Totals").Range("E10").Select[/B][/U]
  
    Else

previous = Worksheets("Totals").Range("E10").Value
Worksheets("Totals").Range("AB1").Value = previous
Worksheets("Totals").Range("E10").Range("E10").Select

End If
End Sub
 
Last edited:
Upvote 0
So I've managed to overcome the run time error.

I just replaced

Code:
Worksheets("Totals").Range("E10").Select

with

Code:
Exit sub

The reason for the original line of code is to avoid a "divide by zero" error upon opening if a certain cell was blank. Given that what I was asking for was to just select a cell if there was an error, I don't really care - happy to just exit the sub this point.

I still wonder why it kept throwing this error out though.
 
Upvote 0
Do you have the sheet protected or hidden?
Then it can be the version of your collaborative tool.

Check the vba Tools / References menu, if there is any reference "Missing"

missing-reference-in-vba.png
 
Upvote 0
Doesn't look like I have any missing references.

I am beginning to wonder if the error relates to how the collaborative tool names the workbook when opened. The user must download the file and open, and if they have previously opened a version of the same workbook then there is already a version in the "Downloads" folder and the filename is appended with (1),(2),(3)...etc.

Still - I thought that the 'ThisWorkbook' command would overcome this.
 
Upvote 0
When the user opens the book, does it open as read only?
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,772
Members
452,353
Latest member
strainu

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