A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Links and Linking
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Editing Chart Objects in Code



 
 
Thread Tools Display Modes
  #1  
Old June 2nd, 2004, 05:19 PM
Geoff Goodacre
external usenet poster
 
Posts: n/a
Default Editing Chart Objects in Code

Can anyone please explain why the first statement marked
OK works but the second doesn't? I've checked that the
sheet names are consistent with the sheets in the actual
workbook. Any offers welcome!

Windows(CurrentWorkbook).Activate
Sheets("Comparative graph").Select
ActiveSheet.Unprotect
If CompGraph = "L" Then
ActiveSheet.ChartObjects("Chart 3").Activate '
2nd Comparative Graph
Else
ActiveSheet.ChartObjects("Chart 4").Activate '
3rd Comparative Graph
End If
(OK)ActiveChart.SeriesCollection(1).Values = _
"='" & CFLsheetName & "'!R6C40:R57C40"
(Unable to set the value)ActiveChart.SeriesCollection
(2).Values = _
"='" & JSsheetName & "'!R6C50:R57C50"
ActiveSheet.Protect

  #2  
Old June 2nd, 2004, 05:57 PM
Bill Manville
external usenet poster
 
Posts: n/a
Default Editing Chart Objects in Code

Geoff Goodacre wrote:
I've checked that the
sheet names are consistent with the sheets in the actual
workbook. Any offers welcome!


Hard to tell.
What is JSsheetName?

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - respond to newsgroup

  #3  
Old June 3rd, 2004, 10:00 AM
Geoff Goodacre
external usenet poster
 
Posts: n/a
Default Editing Chart Objects in Code

Hi Bill,

Thanks for your response. JSsheetName and CFLsheetName
are text variables that at the time the code is run
contain the names of the sheets to which the charts are to
be pointed. I've checked that the variables are
consistent (to the last letter, space and capitalisation)
with the sheet names in the workbook.

-----Original Message-----
Geoff Goodacre wrote:
I've checked that the
sheet names are consistent with the sheets in the

actual
workbook. Any offers welcome!


Hard to tell.
What is JSsheetName?

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - respond to newsgroup

.

  #4  
Old June 3rd, 2004, 03:44 PM
Bill Manville
external usenet poster
 
Posts: n/a
Default Editing Chart Objects in Code

Geoff Goodacre wrote:
JSsheetName and CFLsheetName
are text variables

Yes.
I wanted to know the value of the JSsheetName variable at the time the
statement is executed.

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - respond to newsgroup

  #5  
Old June 4th, 2004, 10:29 AM
Geoff Goodacre
external usenet poster
 
Posts: n/a
Default Problem Resolved

The value of the variable was "JS Loose Braeburn".
However, I've resolved the problem. I noticed that the
cells referred to in the first series contained values,
and those in the second series were empty (the code is
building a template that will be populated with numbers in
a later process). I keyed zeroes into the cells
referenced and the code now works. The same action
carried out manually does not object to the empty cells.

Sorry if this was a 'red herring' but this 'quirk' of at
least Excel 97 and 2000 doesn't seem to be documented
anywhere!

-----Original Message-----
Geoff Goodacre wrote:
JSsheetName and CFLsheetName
are text variables

Yes.
I wanted to know the value of the JSsheetName variable at

the time the
statement is executed.

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - respond to newsgroup

.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:13 PM.


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