Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Run-Time Error 1004 Application-Definition or Object-Definition Error


I can't figure it out, This ran with no problem in my test sheet, but
now it gets this error on the

ActiveChart.SeriesCollection(1).XValues = _
"=Team Financial Tables!" & StartCategoryAddress & ":" &
EndCategoryAddress

line. I've triple checked the entire ChartObject section and the
named areas referenced and they seem to be good. The error help is NO
HELP. I have confirned that the variables have the correct values,
but that is where I get stuck. Can someone point me in a good
direction? The entire code is below.

Thanks
Jamie







Sub ResizeChart_Revenue_By_Cust()

Dim TotalsRange As Range
Dim TotalsCell As Range

Dim CategoryRange As Range
Dim CategoryCell As Range

Dim StartTotalsAddress As String
Dim EndTotalsAddress As String

Dim StartCategoryAddress As String
Dim EndCategoryAddress As String

Sheets("Team Financial Tables").Activate
Set TotalsRange = Sheets("Team Financial Tables").Range
("Revenue_By_Customer")
For Each TotalsCell In TotalsRange

If TotalsCell.Value 0 And StartTotalsAddress = "" Then
StartTotalsAddress = TotalsCell.Address
(ReferenceStyle:=xlR1C1)

StartCategoryAddress = TotalsCell.Offset(0, -1).Address
(ReferenceStyle:=xlR1C1)

End If
If TotalsCell.Value = 0 Then
EndTotalsAddress = TotalsCell.Offset(-1).Address
(ReferenceStyle:=xlR1C1)

EndCategoryAddress = TotalsCell.Offset(-1, -1).Address
(ReferenceStyle:=xlR1C1)

Exit For
End If
Next

Sheets("Financial Dashboard").Activate
ActiveSheet.ChartObjects("Chart_Revenue_By_Cust"). Activate
ActiveChart.SeriesCollection(1).DataLabels.Select
ActiveChart.ChartArea.Select

ActiveChart.SeriesCollection(1).XValues = _
"=Team Financial Tables!" & StartCategoryAddress & ":" &
EndCategoryAddress

ActiveChart.SeriesCollection(1).Values = _
"=Team Financial Tables!" & StartTotalsAddress & ":" &
EndTotalsAddress

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Run-Time Error 1004 Application-Definition or Object-DefinitionError

Sometimes, the worksheet name has to be surrounded with apostrophes/single
quotes.

Try
... "='Team Financial Tables'!" & ...



jparnold wrote:

I can't figure it out, This ran with no problem in my test sheet, but
now it gets this error on the

ActiveChart.SeriesCollection(1).XValues = _
"=Team Financial Tables!" & StartCategoryAddress & ":" &
EndCategoryAddress

line. I've triple checked the entire ChartObject section and the
named areas referenced and they seem to be good. The error help is NO
HELP. I have confirned that the variables have the correct values,
but that is where I get stuck. Can someone point me in a good
direction? The entire code is below.

Thanks
Jamie

Sub ResizeChart_Revenue_By_Cust()

Dim TotalsRange As Range
Dim TotalsCell As Range

Dim CategoryRange As Range
Dim CategoryCell As Range

Dim StartTotalsAddress As String
Dim EndTotalsAddress As String

Dim StartCategoryAddress As String
Dim EndCategoryAddress As String

Sheets("Team Financial Tables").Activate
Set TotalsRange = Sheets("Team Financial Tables").Range
("Revenue_By_Customer")
For Each TotalsCell In TotalsRange

If TotalsCell.Value 0 And StartTotalsAddress = "" Then
StartTotalsAddress = TotalsCell.Address
(ReferenceStyle:=xlR1C1)

StartCategoryAddress = TotalsCell.Offset(0, -1).Address
(ReferenceStyle:=xlR1C1)

End If
If TotalsCell.Value = 0 Then
EndTotalsAddress = TotalsCell.Offset(-1).Address
(ReferenceStyle:=xlR1C1)

EndCategoryAddress = TotalsCell.Offset(-1, -1).Address
(ReferenceStyle:=xlR1C1)

Exit For
End If
Next

Sheets("Financial Dashboard").Activate
ActiveSheet.ChartObjects("Chart_Revenue_By_Cust"). Activate
ActiveChart.SeriesCollection(1).DataLabels.Select
ActiveChart.ChartArea.Select

ActiveChart.SeriesCollection(1).XValues = _
"=Team Financial Tables!" & StartCategoryAddress & ":" &
EndCategoryAddress

ActiveChart.SeriesCollection(1).Values = _
"=Team Financial Tables!" & StartTotalsAddress & ":" &
EndTotalsAddress

End Sub


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Run-Time Error 1004 Application-Definition or Object-DefinitionError


I tryed that and the error moved to the second statement. Thats some
progress ;-). But I got the same error. This does not make a lot of
sense.

Jamie









On Dec 24, 5:45*pm, Dave Peterson wrote:
Sometimes, the worksheet name has to be surrounded with apostrophes/single
quotes.

Try
*... "='Team Financial Tables'!" & ...





jparnold wrote:

I can't figure it out, This ran with no problem in my test sheet, but
now it gets this error on the


ActiveChart.SeriesCollection(1).XValues = _
* * "=Team Financial Tables!" & StartCategoryAddress & ":" &
EndCategoryAddress


line. *I've triple checked the entire ChartObject section and the
named areas referenced and they seem to be good. *The error help is NO
HELP. *I have confirned that the variables have the correct values,
but that is where I get stuck. *Can someone point me in a good
direction? *The entire code is below.


Thanks
Jamie


Sub ResizeChart_Revenue_By_Cust()


Dim TotalsRange As Range
Dim TotalsCell As Range


Dim CategoryRange As Range
Dim CategoryCell As Range


Dim StartTotalsAddress As String
Dim EndTotalsAddress As String


Dim StartCategoryAddress As String
Dim EndCategoryAddress As String


Sheets("Team Financial Tables").Activate
Set TotalsRange = Sheets("Team Financial Tables").Range
("Revenue_By_Customer")
* For Each TotalsCell In TotalsRange


* * * *If TotalsCell.Value 0 And StartTotalsAddress = "" Then
* * * * * StartTotalsAddress = TotalsCell.Address
(ReferenceStyle:=xlR1C1)


* * * * * StartCategoryAddress = TotalsCell.Offset(0, -1).Address
(ReferenceStyle:=xlR1C1)


* * * End If
* * * If TotalsCell.Value = 0 Then
* * * * * EndTotalsAddress = TotalsCell.Offset(-1).Address
(ReferenceStyle:=xlR1C1)


* * * * * EndCategoryAddress = TotalsCell.Offset(-1, -1).Address
(ReferenceStyle:=xlR1C1)


* * * * * Exit For
* * * End If
* Next


*Sheets("Financial Dashboard").Activate
* ActiveSheet.ChartObjects("Chart_Revenue_By_Cust"). Activate
* ActiveChart.SeriesCollection(1).DataLabels.Select
* ActiveChart.ChartArea.Select


* ActiveChart.SeriesCollection(1).XValues = _
* * "=Team Financial Tables!" & StartCategoryAddress & ":" &
EndCategoryAddress


* ActiveChart.SeriesCollection(1).Values = _
* * "=Team Financial Tables!" & StartTotalsAddress & ":" &
EndTotalsAddress


End Sub


--

Dave Peterson- Hide quoted text -

- Show quoted text -


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Run-Time Error 1004 Application-Definition or Object-DefinitionError

That assigment depends on what other parts of your code found.

Maybe you should check to see what the variables are before that line executes:

Msgbox StartCategoryAddress & vblf & EndCategoryAddress

ActiveChart.SeriesCollection(1).XValues = _
....

===
Or you could try assigning a valid range address:

ActiveChart.SeriesCollection(1).XValues _
= "='Team Financial Tables!'a1:a9"

(Choose the address that makes sense for your chart.)

At least then you'll have some idea what to work on next.

jparnold wrote:

I tryed that and the error moved to the second statement. Thats some
progress ;-). But I got the same error. This does not make a lot of
sense.

Jamie

On Dec 24, 5:45 pm, Dave Peterson wrote:
Sometimes, the worksheet name has to be surrounded with apostrophes/single
quotes.

Try
... "='Team Financial Tables'!" & ...





jparnold wrote:

I can't figure it out, This ran with no problem in my test sheet, but
now it gets this error on the


ActiveChart.SeriesCollection(1).XValues = _
"=Team Financial Tables!" & StartCategoryAddress & ":" &
EndCategoryAddress


line. I've triple checked the entire ChartObject section and the
named areas referenced and they seem to be good. The error help is NO
HELP. I have confirned that the variables have the correct values,
but that is where I get stuck. Can someone point me in a good
direction? The entire code is below.


Thanks
Jamie


Sub ResizeChart_Revenue_By_Cust()


Dim TotalsRange As Range
Dim TotalsCell As Range


Dim CategoryRange As Range
Dim CategoryCell As Range


Dim StartTotalsAddress As String
Dim EndTotalsAddress As String


Dim StartCategoryAddress As String
Dim EndCategoryAddress As String


Sheets("Team Financial Tables").Activate
Set TotalsRange = Sheets("Team Financial Tables").Range
("Revenue_By_Customer")
For Each TotalsCell In TotalsRange


If TotalsCell.Value 0 And StartTotalsAddress = "" Then
StartTotalsAddress = TotalsCell.Address
(ReferenceStyle:=xlR1C1)


StartCategoryAddress = TotalsCell.Offset(0, -1).Address
(ReferenceStyle:=xlR1C1)


End If
If TotalsCell.Value = 0 Then
EndTotalsAddress = TotalsCell.Offset(-1).Address
(ReferenceStyle:=xlR1C1)


EndCategoryAddress = TotalsCell.Offset(-1, -1).Address
(ReferenceStyle:=xlR1C1)


Exit For
End If
Next


Sheets("Financial Dashboard").Activate
ActiveSheet.ChartObjects("Chart_Revenue_By_Cust"). Activate
ActiveChart.SeriesCollection(1).DataLabels.Select
ActiveChart.ChartArea.Select


ActiveChart.SeriesCollection(1).XValues = _
"=Team Financial Tables!" & StartCategoryAddress & ":" &
EndCategoryAddress


ActiveChart.SeriesCollection(1).Values = _
"=Team Financial Tables!" & StartTotalsAddress & ":" &
EndTotalsAddress


End Sub


--

Dave Peterson- Hide quoted text -

- Show quoted text -


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Run-Time Error 1004 Application-Definition or Object-Definitio

Dave,

IIRC, when I did chart related things (which I haven't done often), I had to
ensure that the addresses were in R1C1 notation. I wonder if that's the
issue.
--
HTH,

Barb Reinhardt



"Dave Peterson" wrote:

That assigment depends on what other parts of your code found.

Maybe you should check to see what the variables are before that line executes:

Msgbox StartCategoryAddress & vblf & EndCategoryAddress

ActiveChart.SeriesCollection(1).XValues = _
....

===
Or you could try assigning a valid range address:

ActiveChart.SeriesCollection(1).XValues _
= "='Team Financial Tables!'a1:a9"

(Choose the address that makes sense for your chart.)

At least then you'll have some idea what to work on next.

jparnold wrote:

I tryed that and the error moved to the second statement. Thats some
progress ;-). But I got the same error. This does not make a lot of
sense.

Jamie

On Dec 24, 5:45 pm, Dave Peterson wrote:
Sometimes, the worksheet name has to be surrounded with apostrophes/single
quotes.

Try
... "='Team Financial Tables'!" & ...





jparnold wrote:

I can't figure it out, This ran with no problem in my test sheet, but
now it gets this error on the

ActiveChart.SeriesCollection(1).XValues = _
"=Team Financial Tables!" & StartCategoryAddress & ":" &
EndCategoryAddress

line. I've triple checked the entire ChartObject section and the
named areas referenced and they seem to be good. The error help is NO
HELP. I have confirned that the variables have the correct values,
but that is where I get stuck. Can someone point me in a good
direction? The entire code is below.

Thanks
Jamie

Sub ResizeChart_Revenue_By_Cust()

Dim TotalsRange As Range
Dim TotalsCell As Range

Dim CategoryRange As Range
Dim CategoryCell As Range

Dim StartTotalsAddress As String
Dim EndTotalsAddress As String

Dim StartCategoryAddress As String
Dim EndCategoryAddress As String

Sheets("Team Financial Tables").Activate
Set TotalsRange = Sheets("Team Financial Tables").Range
("Revenue_By_Customer")
For Each TotalsCell In TotalsRange

If TotalsCell.Value 0 And StartTotalsAddress = "" Then
StartTotalsAddress = TotalsCell.Address
(ReferenceStyle:=xlR1C1)

StartCategoryAddress = TotalsCell.Offset(0, -1).Address
(ReferenceStyle:=xlR1C1)

End If
If TotalsCell.Value = 0 Then
EndTotalsAddress = TotalsCell.Offset(-1).Address
(ReferenceStyle:=xlR1C1)

EndCategoryAddress = TotalsCell.Offset(-1, -1).Address
(ReferenceStyle:=xlR1C1)

Exit For
End If
Next

Sheets("Financial Dashboard").Activate
ActiveSheet.ChartObjects("Chart_Revenue_By_Cust"). Activate
ActiveChart.SeriesCollection(1).DataLabels.Select
ActiveChart.ChartArea.Select

ActiveChart.SeriesCollection(1).XValues = _
"=Team Financial Tables!" & StartCategoryAddress & ":" &
EndCategoryAddress

ActiveChart.SeriesCollection(1).Values = _
"=Team Financial Tables!" & StartTotalsAddress & ":" &
EndTotalsAddress

End Sub

--

Dave Peterson- Hide quoted text -

- Show quoted text -


--

Dave Peterson
.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Run-Time Error 1004 Application-Definition or Object-Definitio

That sounds like it could be the problem. (I do my best to stay away from
charts! <vbg)

But I do try to stay away from using strings and let excel do it for me.

ActiveChart.SeriesCollection(1).XValues _
= worksheets("Team Financial Tables").range(StartCategoryAddress, _
EndCategoryAddress)

I don't have to remember any of the syntax.


Barb Reinhardt wrote:

Dave,

IIRC, when I did chart related things (which I haven't done often), I had to
ensure that the addresses were in R1C1 notation. I wonder if that's the
issue.
--
HTH,

Barb Reinhardt

"Dave Peterson" wrote:

That assigment depends on what other parts of your code found.

Maybe you should check to see what the variables are before that line executes:

Msgbox StartCategoryAddress & vblf & EndCategoryAddress

ActiveChart.SeriesCollection(1).XValues = _
....

===
Or you could try assigning a valid range address:

ActiveChart.SeriesCollection(1).XValues _
= "='Team Financial Tables!'a1:a9"

(Choose the address that makes sense for your chart.)

At least then you'll have some idea what to work on next.

jparnold wrote:

I tryed that and the error moved to the second statement. Thats some
progress ;-). But I got the same error. This does not make a lot of
sense.

Jamie

On Dec 24, 5:45 pm, Dave Peterson wrote:
Sometimes, the worksheet name has to be surrounded with apostrophes/single
quotes.

Try
... "='Team Financial Tables'!" & ...





jparnold wrote:

I can't figure it out, This ran with no problem in my test sheet, but
now it gets this error on the

ActiveChart.SeriesCollection(1).XValues = _
"=Team Financial Tables!" & StartCategoryAddress & ":" &
EndCategoryAddress

line. I've triple checked the entire ChartObject section and the
named areas referenced and they seem to be good. The error help is NO
HELP. I have confirned that the variables have the correct values,
but that is where I get stuck. Can someone point me in a good
direction? The entire code is below.

Thanks
Jamie

Sub ResizeChart_Revenue_By_Cust()

Dim TotalsRange As Range
Dim TotalsCell As Range

Dim CategoryRange As Range
Dim CategoryCell As Range

Dim StartTotalsAddress As String
Dim EndTotalsAddress As String

Dim StartCategoryAddress As String
Dim EndCategoryAddress As String

Sheets("Team Financial Tables").Activate
Set TotalsRange = Sheets("Team Financial Tables").Range
("Revenue_By_Customer")
For Each TotalsCell In TotalsRange

If TotalsCell.Value 0 And StartTotalsAddress = "" Then
StartTotalsAddress = TotalsCell.Address
(ReferenceStyle:=xlR1C1)

StartCategoryAddress = TotalsCell.Offset(0, -1).Address
(ReferenceStyle:=xlR1C1)

End If
If TotalsCell.Value = 0 Then
EndTotalsAddress = TotalsCell.Offset(-1).Address
(ReferenceStyle:=xlR1C1)

EndCategoryAddress = TotalsCell.Offset(-1, -1).Address
(ReferenceStyle:=xlR1C1)

Exit For
End If
Next

Sheets("Financial Dashboard").Activate
ActiveSheet.ChartObjects("Chart_Revenue_By_Cust"). Activate
ActiveChart.SeriesCollection(1).DataLabels.Select
ActiveChart.ChartArea.Select

ActiveChart.SeriesCollection(1).XValues = _
"=Team Financial Tables!" & StartCategoryAddress & ":" &
EndCategoryAddress

ActiveChart.SeriesCollection(1).Values = _
"=Team Financial Tables!" & StartTotalsAddress & ":" &
EndTotalsAddress

End Sub

--

Dave Peterson- Hide quoted text -

- Show quoted text -


--

Dave Peterson
.


--

Dave Peterson
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
Run Time Error 1004 Application-defined or object-defined error forsimple loop? Need help with what's wrong? Naji[_2_] Excel Programming 2 October 16th 09 05:45 PM
Export a chart in a GIF file. Run-time error '1004': Application-defined or object-defined error; [email protected] Excel Programming 4 September 16th 07 11:09 PM
Run Time Error 1004: Application or Object Defined Error BEEJAY Excel Programming 4 October 18th 06 04:19 PM
Run Time 1004 Error: Application or Object Difine Error BEEJAY Excel Programming 0 October 17th 06 10:45 PM
run-time error '1004': Application-defined or object-deifined error [email protected] Excel Programming 5 August 10th 05 09:39 PM


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

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

About Us

"It's about Microsoft Excel"