#1   Report Post  
Posted to microsoft.public.excel.misc
Jeff
 
Posts: n/a
Default Using Ranges

Hi,

I did an insert -- name -- define: a range that would automatically update:

RangeName = "Sheet2!$C$4:$Q$"&COUNT(Sheet2!$E$4000)+3

So I want to write a macro that uses the range.
x = Range("RangeName").Value
gives the following error:
Method Range of Object Global Failed

when i set a range in the worksheet using the upper left hand box the macro
works.
Do you know how to fix this problem.

Thanks






  #2   Report Post  
Posted to microsoft.public.excel.misc
Bernie Deitrick
 
Posts: n/a
Default Using Ranges

That won't work - it's just an invalid string value, not a range. You need to use a named range
whose definition actually returns a range, along the lines of

=OFFSET(Sheet2!$C$4,0,0,COUNT(Sheet2!$E$4000) +3,15)

But note that COUNT(Sheet2!$E$4000) can only return 0 or 1, since it is only one cell, which can be
empty or filled. Perhaps you mean something like

COUNT(Sheet2!$E$1:$E$4000)

In which case, the whole thing becomes

=OFFSET(Sheet2!$C$4,0,0,COUNT(Sheet2!$E$1:$E$4000) +3,15)

HTH,
Bernie
MS Excel MVP


"Jeff" wrote in message
...
Hi,

I did an insert -- name -- define: a range that would automatically update:

RangeName = "Sheet2!$C$4:$Q$"&COUNT(Sheet2!$E$4000)+3

So I want to write a macro that uses the range.
x = Range("RangeName").Value
gives the following error:
Method Range of Object Global Failed

when i set a range in the worksheet using the upper left hand box the macro
works.
Do you know how to fix this problem.

Thanks








Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I find all named ranges in VB.NET? John Brock Excel Discussion (Misc queries) 5 September 2nd 05 04:39 PM
Like 123, allow named ranges, and print named ranges WP Excel Discussion (Misc queries) 1 April 8th 05 06:07 PM
Problem with graph ranges No Such Luck Charts and Charting in Excel 6 December 3rd 04 01:09 PM
compare unique identifiers in multiple ranges bawilli_91125 Charts and Charting in Excel 1 November 30th 04 06:34 PM
Named dynamic ranges, copied worksheets and graph source data WP Charts and Charting in Excel 1 November 28th 04 05:19 PM


All times are GMT +1. The time now is 11:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"