View Single Post
  #21  
Old June 17th, 2004, 10:43 PM
z.entropic
external usenet poster
 
Posts: n/a
Default macro to create charts in worksheets with arbitrary names

Jon, I found the source of my problem. It had nothing to do with your or Tushar's programing.

The spreadsheets in which I tried to use the macro are generated by an XLA program written by an outside firm. They chose the names of the worksheets in the form of 'Channel_I-013', and the 'minus' sign has been the source of all this trouble. Even though the worksheet name is not specifically used by the macro discussed here, somehow some piece of VBA code looks at it, 'thinks' it's a subtraction sign and screws everything up at
'' Define the data and type
ActiveChart.SeriesCollection(1).Values = "=" & sSheet & "!R2C8:R1000C8"
If I remove the minus sign or replace it with an underscore sign, everythng runs smoothly.

So, the lesson is, don't ever use hyphens in worksheet names even though the sign is not listed on the list of proscribed charatcerrs in worksheet names: \ / * ? [ ]! Maybe now somebody will suggest how to incorporate the worksheet name change into the macro to get rid of this offensive minus/hyphen sign! ;-).

Great thanks again for your untiring efforts to help me; this was quite an education!
z.entropic
==================================