Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 92
Default XValues - Why is code1 OK - but code2 doesn't work?

Hi, I have a xlColumnClustered chart of three bars only, with values
and names picked from cells not besie eachother. The first working code
is based on recording, but I can't have RC reference in my code.

The second code, I get "Unable to set the XValues property of the
Series class" 1004 runtime error.

Why doesn't the second work?

'cht.SeriesCollection(1).XValues = _
' "=(Report!R6C7,Report!R6C4,Report!R3C17)"

cht.SeriesCollection(1).XValues = Union(Sheet2.Range("nme1"),
Sheet2.Range("nme2"), _ Sheet2.Range("nme3"))

Kind regards
tskogstrom

  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 2,489
Default XValues - Why is code1 OK - but code2 doesn't work?

Hi,

An educated guess would be that the assignment can not deal with
multiple areas.

Try this instead, where each element is fully described.

cht.SeriesCollection(1).XValues = "=('" & _
Sheet2.Name & "'!" & _
Sheet2.Range("nme1").Address(True, True, xlR1C1) & _
",'" & Sheet2.Name & "'!" & _
Sheet2.Range("nme2").Address(True, True, xlR1C1) & _
",'" & Sheet2.Name & "'!" & _
Sheet2.Range("nme3").Address(True, True, xlR1C1) & ")"

Cheers
Andy

tskogstrom wrote:
Hi, I have a xlColumnClustered chart of three bars only, with values
and names picked from cells not besie eachother. The first working code
is based on recording, but I can't have RC reference in my code.

The second code, I get "Unable to set the XValues property of the
Series class" 1004 runtime error.

Why doesn't the second work?

'cht.SeriesCollection(1).XValues = _
' "=(Report!R6C7,Report!R6C4,Report!R3C17)"

cht.SeriesCollection(1).XValues = Union(Sheet2.Range("nme1"),
Sheet2.Range("nme2"), _ Sheet2.Range("nme3"))

Kind regards
tskogstrom


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
  #3   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 92
Default XValues - Why is code1 OK - but code2 doesn't work?

Thank you, your guess was correct - it work ok now.

Thanks again,
tskogstrom



Andy Pope skrev:

Hi,

An educated guess would be that the assignment can not deal with
multiple areas.

Try this instead, where each element is fully described.

cht.SeriesCollection(1).XValues = "=('" & _
Sheet2.Name & "'!" & _
Sheet2.Range("nme1").Address(True, True, xlR1C1) & _
",'" & Sheet2.Name & "'!" & _
Sheet2.Range("nme2").Address(True, True, xlR1C1) & _
",'" & Sheet2.Name & "'!" & _
Sheet2.Range("nme3").Address(True, True, xlR1C1) & ")"

Cheers
Andy

tskogstrom wrote:
Hi, I have a xlColumnClustered chart of three bars only, with values
and names picked from cells not besie eachother. The first working code
is based on recording, but I can't have RC reference in my code.

The second code, I get "Unable to set the XValues property of the
Series class" 1004 runtime error.

Why doesn't the second work?

'cht.SeriesCollection(1).XValues = _
' "=(Report!R6C7,Report!R6C4,Report!R3C17)"

cht.SeriesCollection(1).XValues = Union(Sheet2.Range("nme1"),
Sheet2.Range("nme2"), _ Sheet2.Range("nme3"))

Kind regards
tskogstrom


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info


  #4   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 92
Default XValues - Why is code1 OK - but code2 doesn't work?

I recently got a similar error, but the problem was that the reference
area of the chart was hidden rows and columns.

Seems like charts demand visible cells...hope this help someone more
....This might have been the reason to this tread question also.

/Regards
tskogstrom
-------------------------------



tskogstrom skrev:

Thank you, your guess was correct - it work ok now.

Thanks again,
tskogstrom



Andy Pope skrev:

Hi,

An educated guess would be that the assignment can not deal with
multiple areas.

Try this instead, where each element is fully described.

cht.SeriesCollection(1).XValues = "=('" & _
Sheet2.Name & "'!" & _
Sheet2.Range("nme1").Address(True, True, xlR1C1) & _
",'" & Sheet2.Name & "'!" & _
Sheet2.Range("nme2").Address(True, True, xlR1C1) & _
",'" & Sheet2.Name & "'!" & _
Sheet2.Range("nme3").Address(True, True, xlR1C1) & ")"

Cheers
Andy

tskogstrom wrote:
Hi, I have a xlColumnClustered chart of three bars only, with values
and names picked from cells not besie eachother. The first working code
is based on recording, but I can't have RC reference in my code.

The second code, I get "Unable to set the XValues property of the
Series class" 1004 runtime error.

Why doesn't the second work?

'cht.SeriesCollection(1).XValues = _
' "=(Report!R6C7,Report!R6C4,Report!R3C17)"

cht.SeriesCollection(1).XValues = Union(Sheet2.Range("nme1"),
Sheet2.Range("nme2"), _ Sheet2.Range("nme3"))

Kind regards
tskogstrom


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info


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
Dates and Recomended Graphing Programs to work with excel? John Charts and Charting in Excel 2 December 8th 05 07:58 PM
A search for $ in a formula use to work now it does not work JuneJuly Excel Discussion (Misc queries) 2 November 30th 05 10:13 PM
Moving a sheet from one work book to another? WTG Excel Worksheet Functions 1 November 3rd 05 07:12 PM
My links no longer work . . . mike Excel Discussion (Misc queries) 8 October 27th 05 11:59 PM
Work Rota - Do I need a formula? dataheadache Excel Discussion (Misc queries) 11 October 3rd 05 10:53 PM


All times are GMT +1. The time now is 02:44 PM.

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"