Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

X-axis value of Excel chart
I have problem with assigning x-axis value of a chart.

This is how I assign y-axis value. LastCell is a variable.
xlCht1.SeriesCollection(1).XValues = xlWshtS.Range("E4:E" & LastCell)

I know this can assign values for both axes, but it can't use LastCell.
xlCht1.SeriesCollection(1).XValues = xlWshtS!"R4C1:R10C1"

Any suggestion?

Thanks,
Kate

Report this thread to moderator Post Follow-up to this message
Old Post
Kate
05-22-05 08:55 PM


RE: X-axis value of Excel chart
Kate,

Try switching off the R1C1 reference style.. Are you using Visual Basic 6 or
VBA ?

Kevan

"Kate" wrote:

> I have problem with assigning x-axis value of a chart.
>
> This is how I assign y-axis value. LastCell is a variable.
> xlCht1.SeriesCollection(1).XValues = xlWshtS.Range("E4:E" & LastCell)
>
> I know this can assign values for both axes, but it can't use LastCell.
> xlCht1.SeriesCollection(1).XValues = xlWshtS!"R4C1:R10C1"
>
> Any suggestion?
>
> Thanks,
> Kate

Report this thread to moderator Post Follow-up to this message
Old Post
Kevan Hughes
05-23-05 01:55 AM


RE: X-axis value of Excel chart
I use VB6.  How to switch off R1C1? and even if it's switched off, I still
don't know how to assign value for x-axis...

Thanks,
Kate

"Kevan Hughes" wrote:

> Kate,
>
> Try switching off the R1C1 reference style.. Are you using Visual Basic 6 
or
> VBA ?
>
> Kevan
>
> "Kate" wrote:
> 

Report this thread to moderator Post Follow-up to this message
Old Post
Kate
05-23-05 08:55 PM


RE: X-axis value of Excel chart
In Excel use TOOLS, OPTIONS then General.. Settings show R1C1.. uncheck the
box.. I gather you want to create a graph ?

"Kate" wrote:

> I use VB6.  How to switch off R1C1? and even if it's switched off, I still
> don't know how to assign value for x-axis...
>
> Thanks,
> Kate
>
> "Kevan Hughes" wrote:
> 

Report this thread to moderator Post Follow-up to this message
Old Post
Kevan Hughes
05-23-05 08:55 PM


RE: X-axis value of Excel chart
R1C1 is already off.
Yes, I'm trying to create a chart.  Sorry that I didn't state it clearly.

For example, the chart type is xlColumnClustered. The range of y-axis is
colB, colC, and colD, from row1 to rowVariable. The range of x-axis is colA,
from row1 to rowVariable.  How to create a chart like that?

Now, I use:
xlCht1.ChartType = xlColumnClustered
xlCht1.SeriesCollection(1).XValues = xlWshtS.Range("B1:B" & rowVariable)
The chart looks fine, except that the value of x-axis is missing.

Thanks
Kate

"Kevan Hughes" wrote:

> In Excel use TOOLS, OPTIONS then General.. Settings show R1C1.. uncheck th
e
> box.. I gather you want to create a graph ?
>


Report this thread to moderator Post Follow-up to this message
Old Post
Kate
05-24-05 01:55 PM


RE: X-axis value of Excel chart
Kate, take a look at a sample.. You be missing a string declaration. Sample
is loaded when installing VB locally..  should be \VB98\SAMPLES\VB98\CHRSAMP
folder. The MODCHART.BAS is the code you should look at, DATE VALUES are use
d
for x-axis labels/values.. IS this useful ?

Public Sub PopOneArray(thisarray As Variant, col As String)
' This procedure just populates arrays.
Dim i As Integer
ReDim thisarray(1 To intRows, 1 To 2)
For i = 1 To intRows
' Get the Date values.
thisarray(i, 1) = CStr(rngGas.Range("A" & i + 1).Value)
' Get values.
thisarray(i, 2) = Format(rngGas.Range(col & i + 1).Value, "##.##")
frmChart.prgArrays.Value = i
Next i

End Sub

"Kate" wrote:

> R1C1 is already off.
> Yes, I'm trying to create a chart.  Sorry that I didn't state it clearly.
>
> For example, the chart type is xlColumnClustered. The range of y-axis is
> colB, colC, and colD, from row1 to rowVariable. The range of x-axis is col
A,
> from row1 to rowVariable.  How to create a chart like that?
>
> Now, I use:
> xlCht1.ChartType = xlColumnClustered
> xlCht1.SeriesCollection(1).XValues = xlWshtS.Range("B1:B" & rowVariable)
> The chart looks fine, except that the value of x-axis is missing.
>
> Thanks
> Kate
>
> "Kevan Hughes" wrote:
> 
>

Report this thread to moderator Post Follow-up to this message
Old Post
Kevan Hughes
05-24-05 01:55 PM


RE: X-axis value of Excel chart
Kevan,
I think it would be useful, but I don't have the SAMPLES folder...
Would you attach the MODCHART.BAS to me?
Thanks,
Kate

"Kevan Hughes" wrote:

> Kate, take a look at a sample.. You be missing a string declaration. Sampl
e
> is loaded when installing VB locally..  should be \VB98\SAMPLES\VB98\CHRSA
MP
> folder. The MODCHART.BAS is the code you should look at, DATE VALUES are u
sed
> for x-axis labels/values.. IS this useful ?
>
> Public Sub PopOneArray(thisarray As Variant, col As String)
>     ' This procedure just populates arrays.
>     Dim i As Integer
>     ReDim thisarray(1 To intRows, 1 To 2)
>     For i = 1 To intRows
>         ' Get the Date values.
>         thisarray(i, 1) = CStr(rngGas.Range("A" & i + 1).Value)
>         ' Get values.
>         thisarray(i, 2) = Format(rngGas.Range(col & i + 1).Value, "##.##")
>         frmChart.prgArrays.Value = i
>     Next i
>
> End Sub


Report this thread to moderator Post Follow-up to this message
Old Post
Kate
05-26-05 08:55 AM


RE: X-axis value of Excel chart
kevanhughes@hotmail.com

I can send the all the files to you if you email me above.. It is useful to
see the complete application in action..

"Kate" wrote:

> Kevan,
> I think it would be useful, but I don't have the SAMPLES folder...
> Would you attach the MODCHART.BAS to me?
> Thanks,
> Kate
>
> "Kevan Hughes" wrote:
> 
>

Report this thread to moderator Post Follow-up to this message
Old Post
Kevan Hughes
05-27-05 08:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Visual Basic archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 06:29 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.