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: 1
Default Dyanamic range - Object Required Error?


I am trying to create an embedded chart with a named dynamic range so
that the range (and chart) will expand as new data is entered. The
code runs fine with a a normal range.

I created the "Named Range" on the Inventory worksheet. The range is
named "Vehicle_Count" with the following formula.

=OFFSET(Inventory!$D$55,0,0,COUNTA(Inventory!$D:$D ),2)

The data for the range resides on the Inventory worksheet . C55 though
C85 are the different names of the inventory (cars, trucks, buses. etc.)
D55 through D85 holds the number of cars, trucks, buses, etc. in
inventory.

The code below stops at .SetSourceData Source:=Vehicle_Count with an
Object Required Error? The code is below.

Al you ideas would be appreciated. Named ranges, well heck just
ranges, confuse me.

Thanks

Craig

--------------------
Sub AddEmbeddedChart(sToSheet As String, sTitle As String, sRng As
Range, sUpper As String, sLeft As String, sWidth As String, sHeight As
String, sName As String)
Dim chrtNew As Chart
Dim rngVehicles As Range

Sheets(sToSheet).Select

Set chrtNew = Charts.Add
Set chrtNew = chrtNew.Location(whe=xlLocationAsObject,
Name:=sToSheet) 'Sheet where chart will be placed
With chrtNew
..ChartType = xlColumnClustered

..SetSourceData Source:=Vehicle_Count 'Dyanmic range not
working

'Object Required error
..HasTitle = True
..ChartTitle.Text = sTitle
..Legend.Position = xlLegendPositionBottom
..HasLegend = False
..HasDataTable = False
..HasLegend = False
With .Parent
..Top = Range(sUpper).Top
..Left = Range(sLeft).Left
..Width = sWidth
..Height = sHeight
..RoundedCorners = True
..Shadow = True
..Visible = True
..Name = sName 'Name that gets activated for chart
manipulation
End With
End With

ActiveChart.Deselect 'Removes all handles
End Sub


--
Craigm
------------------------------------------------------------------------
Craigm's Profile: http://www.excelforum.com/member.php...o&userid=24381
View this thread: http://www.excelforum.com/showthread...hreadid=530537

 
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
Object Required Error 424 Jason Excel Programming 2 December 28th 05 10:27 PM
Object required error broogle Excel Programming 7 March 21st 05 09:01 AM
Error: 424 Object required DavidM[_3_] Excel Programming 1 January 13th 05 03:23 PM
Syntax Error Runtime Error '424' Object Required sjenks183 Excel Programming 1 January 23rd 04 09:25 AM
error 424 - Object Required blb Excel Programming 0 October 1st 03 05:32 PM


All times are GMT +1. The time now is 03:12 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"