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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Allocate Ranges with Chart Sheet active fails 1

Status
Not open for further replies.

Loomah

Technical User
Mar 4, 2002
1,911
IE
Does anybody know why the following code fails when the active sheet is a Chart sheet. There are no chart objects (other than the chart itself) selected.

Code:
ActiveWorkbook.Names.Add Name:="Data_Full", _
    RefersTo:="=RawData!" & Range(Cells(1, 1), Cells(lRow, LAST_DATA_COL)).Address

error is 1004 - "Method 'Cells' of object '_Global' failed"

thanks and merry xmas!!

;-)
If a man says something and there are no women there to hear him, is he still wrong? [ponder]
How do I get the best answers?
 
AFAIK, a chart sheet has NO cells ...
I'd use this:
Code:
RefersTo:="=RawData!" & Range(Sheets("RawData").Cells(1, 1), Sheets("RawData").Cells(lRow, LAST_DATA_COL)).Address

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PH
You are, as you always have been, a star.

It's obvious once pointed out, just wasn't hinking about where xl was trying to pick up the reference. Out of practice coupled with brain drain near Christmas!

Thanks and enjoy!

;-)
If a man says something and there are no women there to hear him, is he still wrong? [ponder]
How do I get the best answers?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top