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 Dynamic range (object variable error)


Hello all,

I need help selecting a range for my chart. The number of rows ar
always going to change. Right now, my code selects A1:E12 and it work
perfectly as long as data is exactly that range, but anything more o
less than that gives errors.

I am trying to select the first and last cell (range for the char
creation), please see code below. but i get "runtime error 91: objec
variable not set". What am i doing wrong? :)


Code
-------------------
Dim end_row As Long
'Set end_row = Sheets("TradeVolume-Chart").Range("A65536").End(xlUp).Row
ActiveSheet.Columns("A:E").Select
end_row = Range("A65536").End(xlUp).Row


Charts.Add
ActiveChart.ApplyCustomType ChartType:=xlBuiltIn, TypeName:="Line - Column on 2 Axes"
ActiveChart.SetSourceData Source:=Sheets("TradeVolume-Chart").Range("A" & end_row), PlotBy:=xlColumns
'ActiveChart.SetSourceData Source:=Sheets("TradeVolume-Chart").Range("A1:E12"), PlotBy:=xlColumns
ActiveChart.Location Whe=xlLocationAsObject, Name:="TradeVolume-Chart
-------------------

--
Mslad
-----------------------------------------------------------------------
Mslady's Profile: http://www.excelforum.com/member.php...fo&userid=2777
View this thread: http://www.excelforum.com/showthread.php?threadid=48083

 
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
Runtime Error '91' Object variable or With block variable not set Alec Coliver Excel Discussion (Misc queries) 2 October 24th 09 02:29 PM
Object Variable Not Set Error on Selection object Jean Excel Worksheet Functions 3 July 24th 06 06:45 PM
Run-time error '91': "Object variable or With block variable not set Mike[_92_] Excel Programming 2 December 30th 04 10:59 AM
Error 91 -- Object variable or With block variable not set Rachael[_3_] Excel Programming 2 November 22nd 04 02:59 PM
Cells.Find error Object variable or With block variable not set Peter[_21_] Excel Programming 2 May 8th 04 02:15 PM


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