Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run-time Error 1004 - Method 'Range' of object '_Global' failed

Status
Not open for further replies.

Phoenix22

Technical User
Sep 23, 2003
29
CA
Hi,

I get an error on the line " Range("range_mtl").Select " in the code below. It complains that "Method 'Range' of Object '_Global' failed.

***********************************

Windows(bh_report_filename).Activate
Names.Add Name:="range_mtl", RefersTo:="=MTL!" & "C2:" & "F" & row_mtl
Sheets("MTL").Activate
Range("range_mtl").Select
Selection.Copy

**********************************

I don't really understand why this is happening because if I just use "Range("range_mtl").Select without prefixing it with an object, shouldn't it just use the ActiveSheet object?

Any help would be much appreciated, thanks.
 
There are just too many ways this can go wrong:

How are the variables declared (Dimmed)?
What is in bh_report_filename?
Is the workbook open?
What is in row_mtl?
Is there a sheet named MTL in the workbook?
 
Hi Phoenix22,

Are you actually defining a name for a valid range? What is variable row_mtl? If it is empty, for example, you will get that error.

Enjoy,
Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top