Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
try this instead
Range ("A1:E" & end_row) of Range("A" & end_row) -- Gary "Mslady" wrote in message ... Hello all, I need help selecting a range for my chart. The number of rows are always going to change. Right now, my code selects A1:E12 and it works perfectly as long as data is exactly that range, but anything more or less than that gives errors. I am trying to select the first and last cell (range for the chart creation), please see code below. but i get "runtime error 91: object 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" -------------------- -- Mslady ------------------------------------------------------------------------ Mslady's Profile: http://www.excelforum.com/member.php...o&userid=27776 View this thread: http://www.excelforum.com/showthread...hreadid=480837 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() please help :) ;) -- Mslady ------------------------------------------------------------------------ Mslady's Profile: http://www.excelforum.com/member.php...o&userid=27776 View this thread: http://www.excelforum.com/showthread...hreadid=480837 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() *sighs....:( -- Mslady ------------------------------------------------------------------------ Mslady's Profile: http://www.excelforum.com/member.php...o&userid=27776 View this thread: http://www.excelforum.com/showthread...hreadid=480837 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Runtime Error '91' Object variable or With block variable not set | Excel Discussion (Misc queries) | |||
Object Variable Not Set Error on Selection object | Excel Worksheet Functions | |||
Run-time error '91': "Object variable or With block variable not set | Excel Programming | |||
Error 91 -- Object variable or With block variable not set | Excel Programming | |||
Cells.Find error Object variable or With block variable not set | Excel Programming |