• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

method range of object _global failed.

RANJAN V

New Member
Hi,

I have an Excel Workbook that gives me an Error 1004 Method 'Range' of object '_Global' failed:

When I click on Debug button , it shows the code as below:
Sub PEAdvWbRunEntryPoint(Optional val As Variant)

If IsMissing(val) Then
Application.Run "RunForPeriodEntered"
Else
Range("StartDateEntry") = val.DataWindowObj.StartTime
Range("EndDateEntry") = val.DataWindowObj.EndTime
Application.Run "RunForPeriodEntered", val
End If

End Sub
 
Hi Ranjan,

Could you please explain further, at what line you are getting the bug.

This is what @Luke Sir has said about Run Time Error.

Unfortunately, the run time error code seems to be a default "SOMETHING WENT WRONG!!" kind of error.

If you do not know how to check this, please do the following.

1) Open the macro
2) Place the cursor on the module you want to run
3) Press Function key "F8", this will execute one line at a time
4) Keep pressing F8 until you get "Bug"
5) Check at what line you are getting the bug, try to post that details here
 
Last edited:
Hi, RANJAN V!

As a new user you might want (I'd say should and must) read this:
http://chandoo.org/forum/forums/new-users-please-start-here.14/

And regarding your issue, thank you for posting the code of the related procedure but we need to know where is the error actually raising, so when getting prompted with the error window, if you click on Debug, is there any instruction highlighted in yellow?

Regards!
 
Hi, RANJAN V!

I think you don't understand how these forums work, so please go thru this again:
http://chandoo.org/forum/forums/new-users-please-start-here.14/
Specially this part from here:
http://chandoo.org/forum/threads/new-users-please-read.294/
"Start a new post every time you ask a question, even if the theme is similar. The original author may continue asking questions whilst the post is in progress and of course if you are answering questions you may need to ask questions of the initial poster."
This doesn't mean to start a new thread for each question on the same subject, just for different questions on different subjects, so as to keep all stuff related to a subject within the same thread and not spread all over the forum.

I'll try to arrange your 3 topics within 1, and close the other 2. This will be closed.

Please indicate us if you need further assistance about the posting method.

Regards!

PS: Related topics:
http://chandoo.org/forum/threads/method-range-of-object-_global-failed.13940/ ... remains
http://chandoo.org/forum/threads/method-range-of-object-_global-failed.13954/ ... closed
http://chandoo.org/forum/threads/method-range-of-object-_global-failed.13956/ ... closed
 
Hi,

I have an Excel Workbook that gives me an Error 1004 Method 'Range' of object '_Global' failed:

When I click on Debug button , it shows the code as below:
Sub PEAdvWbRunEntryPoint(Optional val As Variant)

If IsMissing(val) Then
Application.Run "RunForPeriodEntered"
Else
Range("StartDateEntry") = val.DataWindowObj.StartTime
Range("EndDateEntry") = val.DataWindowObj.EndTime
Application.Run "RunForPeriodEntered", val
End If

End Sub
 
Hi, RANJAN V!
Any chance you an upload your file? If yes, use the below button Upload A File. Thank you.
Regards!
 
The first thing you should do is look in the Name manager to ensure that the names StartDateEntry and EndDateEntry both exist and that they correctly refer to ranges in the workbook.

(1) If they do exist and you are getting the error, amend your VBA code and qualify both Range properties with the worksheet they belong to, eg:
Code:
'change MyWorksheet to the correct name of the worksheet
Worksheets("MyWorksheet").Range("StartDateEntry").Value = val.DataWindowObj.StartTime

(2) If they don't exist (and assuming they are not hidden names) or do not correctly refer to a Range then that would explain the error - you need to re-define them.
 
Back
Top