| | |
Err#1004 "Unable to set the XValues property of the Series class"
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jan 2008
Posts: 56
Reputation:
Solved Threads: 0
This is an issue that I've discusses many times before, but never with a conclusive solution. I am trying to programmatically change the data range for an existing chart in Excel. My code goes something like this:
The .XValues line results in the "1004 Unable to set the XValues property of the Series class" error. The range contains valid data: numbers, no blanks. When I manually set the chart to this range, everything is fine. Like I said, I've read many people having this problem, but nothing is working for me. I've had no end of trouble dealing with Excel charts. Sometimes they work, sometimes they don't.
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
With WS.CharObjects(SelChart).Chart With .SeriesCollection(1) .XValues =DataWS.Range("A1:A101") '<-----ERROR! .Values = DataWS.Range("B1:B101") End With End With
The .XValues line results in the "1004 Unable to set the XValues property of the Series class" error. The range contains valid data: numbers, no blanks. When I manually set the chart to this range, everything is fine. Like I said, I've read many people having this problem, but nothing is working for me. I've had no end of trouble dealing with Excel charts. Sometimes they work, sometimes they don't.
Hi,
I Guess DataWS is not set to the referring Worksheet...
Try this :
Regards
Veena
I Guess DataWS is not set to the referring Worksheet...
Try this :
vb Syntax (Toggle Plain Text)
With WS.CharObjects(SelChart).Chart With .SeriesCollection(1) .XValues =Sheets("Sheet1").Range("A1:A101") .Values = Sheets("Sheet1").Range("B1:B101") End With End With
Regards
Veena
•
•
Join Date: Nov 2009
Posts: 1
Reputation:
Solved Threads: 0
Hi
I found that this bug cause the program not working only when you do a presentation in front of managers. then it crash
but my solution for this is to run-over all the range (or array, in my case) and make it a string
this is the code for the string (pointing every time on Reported (N):
we need this Chr function because we need to insert string as the Xvalue (and we can just like that add ' " ')
after that, remove the last "," by this code:
then, the last one is to add the brackets:
after this, just:
Hope it will help you (it helpd me
)
Shikeh
I found that this bug cause the program not working only when you do a presentation in front of managers. then it crash

but my solution for this is to run-over all the range (or array, in my case) and make it a string
this is the code for the string (pointing every time on Reported (N):
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
ReportedString = ReportedString & Chr(&H22) & Reported(N) & Chr(&H22) & ","
after that, remove the last "," by this code:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
ReportedString = Left(ReportedString, Len(ReportedString) - 1)
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
ReportedString = "={" & ReportedString & "}"
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
.XValues= ReportedString
)Shikeh
![]() |
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Sending data from winform to website ?
- Next Thread: simple inventory system for school clinic
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





