LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Assing a Name to a Range

I am not having much luck with the following code:

Range("A65000").Select
Selection.End(xlDown).Select
Selection.End(xlUp).Select
ActiveCell.Offset(-1, 0).Select
Range(Selection, Selection.End(xlUp)).Select
Range(Selection, Selection.End(xlToRight)).Select
ActiveWorkbook.Names.Add Name:="Region"

The range is A4:E17, but will almost certainly change in the near future.
It fails on the last line. What am I doing wrong?

I need the named range for a chart, which I am building on the fly:
Dim myChtObj As ChartObject
Set myChtObj = ActiveSheet.ChartObjects.Add _
(Left:=30, Width:=800, Top:=250, Height:=500)

myChtObj.Chart.SetSourceData
Source:=Sheets("Region-Chart").Range("Region")
myChtObj.Chart.ChartType = xlColumnClustered
'etc., etc., etc., etc., etc., etc., etc.,

Thanks,
Ryan---

--
RyGuy
 
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 enter formula sum(range+range)*0.15 sumif(range=3) tkw Excel Discussion (Misc queries) 2 October 1st 09 09:17 PM
How to assing micro to a command button Qazi Ahmad Excel Discussion (Misc queries) 1 April 9th 07 06:38 AM
Excel Addin:Setting the range to the Excel.Range object range prop Rp007 Excel Worksheet Functions 5 November 24th 06 04:30 PM
How assing unique number in a column based on a combination of two cells galin Excel Programming 1 February 1st 06 05:25 PM
Assing a macro to a contro. Richard Excel Discussion (Misc queries) 1 January 22nd 06 10:22 PM


All times are GMT +1. The time now is 07:23 PM.

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"