ActiveX Listbox Does Not Work With VBA Code For Changing Chart Axis Scale?

Jun 5, 2014

I have some code for changing the scale of my chart axes so that when new data is inserted into the column which the chart sources from (say column B), the axis scales on my chart will automatically adjust (as the Excel algorithm sometimes leads to charts which are a bit squashed). This code works fine, and I have included it below.

I have then tried to introduce an ActiveX listbox so that when you select an item in the box, the reference number generated (1,2,3...etc) then determines which data series is inserted into column B using a vlookup function. However, when I do this, the original VBA code for automatically adjusting the chart axes no longer works.

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
With ActiveSheet.ChartObjects(1).Chart

[Code].....

View 4 Replies


ADVERTISEMENT

Determine Minimum Scale Value Of Chart Axis

Dec 14, 2007

how to get the min value scale value off a graph when .MinimumScaleIsAuto = True?
The reason I ask is that I want to make my baseline for the graph that min number so that names from the x axis are not sitting in the middle of the graph. Incognito Auto Merged Post;I feel real bright...just playing around I found my answer...

With .Axes(xlValue)
.MinimumScaleIsAuto = True
.MaximumScaleIsAuto = True
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
.Crosses = xlCustom
.CrossesAt = .MinimumScale
.ReversePlotOrder = False
.ScaleType = xlLinear
.DisplayUnit = xlNone
End With

View 2 Replies View Related

Fixing Chart Axis Scale To Thousands And Displaying Multiplication Display Label On Remaining Number

May 16, 2013

I want to automate the Display labels in my Charts using VBA Coding…

I would need to use this small code in Charts with different Scales as some of the Scales in my Data are in a very large Range close to Trillions so its not possible to have these as the Primary-Y-Axis Scale and therefore I would need to use the in-built Display label option which Excel provides..

However, I always prefer to have the scale in the Range of Thousands so the Max I can have in the Scale can be 10,000 so if there is any Number more than that or the Scale is going above than I would prefer that this gets auto-calculated to Multiply with the remainder and show appropriate Scaling.

For Ex:In this example My largest Number is 4500000000 which is 100 M..So I would want the scale to show 4500 and the Display label as X Millions..

So The Display Label would be different for different Ranges but the Max Scale preffered would be 10,000.

View 8 Replies View Related

Changing Values Of X-axis, And Descending Order Axis(x-axis)

Feb 8, 2009

Two questions:

1) How do make values on x-axis as words? E.g. apples, oranges, etc.

2) Is it possible to have the numbers on x-axis in descending order? If I can figure out 1), I can do this as well, but it would be nice to know if it is possible to have the numbers on x-axis in descending order.

View 8 Replies View Related

Scale In X Axis

Apr 12, 2007

The scale on our chart in the X axis is mandating a numeric number. It is showing "39200" instead of 4/28/07. In any event, we would like to have 4/9/07 -- the last date we have data for and the last date that we have referenced on the X axis.

The chart is in the attached chart.xls and the data is in the attached chart.xls

View 9 Replies View Related

Add Secondary Chart X-axis Below Primary Via Macro Code

Apr 27, 2008

In VBA, how to add a secondary x-axis in the lower portion of the chart if I already have the primary axis in the upper part?

This code

ActiveChart.HasAxis(xlCategory, xlSecondary) = True

just adds it to the upper if I have the primary at lower.

View 4 Replies View Related

Excel 2007 :: Inconsistent Time Scale - X Axis

Mar 8, 2012

Basically I have some performance figures for a fund that I want to make a chart for, the problem is that the first date (the start date of the fund) is 15/09/2011 but every reporting date after that is the end of the month.

So my data looks something like this (not real figures)

15/09/11 20
30/09/11 22
31/10/11 23
30/11/11 25
31/12/11 26
31/01/12 27.5
29/02/12 29

So what I want is a graph where the x axis starts at 15/09/11 but then the next label is 30/09/11 and 31/10/11 etc, while still keeping the scale proportionate to the dates, ie the distance between 15/09/11 and 30/09/11 will be half the distance between 30/09/11 and 31/10/11.

The 2 outcomes I seem to be stuck with is either forcing the graph to start at 31/08/11 and making the y axis cross at 15/09/11, however with this the x axis goes left past the y axis cross point and it just looks dumb, although everything right of the y axis is correct.

Or secondly I get the graph to start at 15/09/11 and set it to label every 1 month and all the labels are 15/09/11, 15/10/11, 15/11/11 etc

I have access to excel 2003 or 2007.

View 4 Replies View Related

Add Vertical Line To 2 Graphs With Scale X Axis At Same Time

Sep 16, 2012

Two graphs with different scale x-axis.

Graph No. 1 with smaller time frame, Daily.
Graph No. 2 with larger time frame, Weekly.
Objective: Add vertical line to mark the same times in both graphs.

Trouble is both graph already utilise the secondary axis. VBA is allowed.

View 6 Replies View Related

Create Chart With Names In Vertical Axis And Values In Horizontal Axis?

Mar 1, 2014

I have a spreadsheet with golfers handicaps, golfers names down the left in column A in rows 3-35. Row 2 has the event numbers titles 1 to 18 (18 events in a year). i need a graph that has the person as the vert axis and the horizontal axis needs to be the event numbers, so i can read down for the person and across to see how there handicaps change from each different event. i have attached the data below.

View 1 Replies View Related

Draw Log Chart Or Edit Axis Intervals And Starting Axis Value

Apr 20, 2007

I have some numeric data that has to be put on a log chart. but there is no option for log charts. so i converted my data to log and then drew a chart but i am unable to edit the axis intervals and starting axis value. whenever i change the value it gets back to its default value,ie 1. can anyone tell me how to draw log chart or how to edit axis intervals and starting axis value?

View 6 Replies View Related

Second Category Axis & Value Axis To Current Chart

Sep 27, 2006

how to incorporate another category and value axis to my existing chart.

1. I need to add a rank axis derived from my data column (C6-C15). This column should rank from highest to lowest and create a tie if any number is repeated. I have arranged the rank column in cells B38:L38 as they would appear. I would like this to appear on the top or bottom of the bar graphs.

2. Second I need to add the frequency of hits which = 3 derived from cell J1 This should appear on the chart were it is currently titled. This should create another bar graph colored green and labeled 3.

3. Lastly the numbers axis can remain the same as it appears on the chart or if it would be better to align as shown in cells B43:L43.

View 5 Replies View Related

Horizontal And Vertical Chart Axis As Value Axis

Jan 26, 2008

What is the best way to have both horizontal and vertical axis as value axis?

View 2 Replies View Related

ActiveX Listbox On Worksheet

Sep 29, 2012

I have two listboxes on a worksheet and using VBA to load values into the listbox. I also have a combobox that is used to determine what values are to be displayed in the listboxes. I select a value from the dropdown list and depending on the value selected, a list gets populated in the listbox. This works just fine.

The problem I'm having is that when I adjust the zoom on the worksheet, 75% for example, the listbox automatically changes the width when new values are displayed. I try using the listbox1.width = xxx, to keep the width in place, but that doesn't really work.

View 3 Replies View Related

Update Chart X Scale With VBA

Feb 16, 2012

I am using a VBA macro which performs a Yahoo webquery to obtain stock data. After the data are downloaded, a chart is updated with the new data.

The current macro updates the scaling on the price axis just fine, however, if I change the time frame the x axis, i.e, time/date axis is either spread out to far or jammed up.

The code for re-scaling the the y axis is shown below:

Code:
Sub UpdateScale()
Dim ChartVar As Chart
Dim lMax As Long, lMin As Long
On Error GoTo ScalingProblem
'Assigns the values in the Min and Max ranges to variables.

[Code]....

Any similar sub that would also rescale the x axis as needed when the data intervals are changed?

View 6 Replies View Related

Scale Chart Series To MIN & MAX

Sep 26, 2007

I have a Scatter chart that plots a simple XYScatter plot. The data for this plot can be very wide ranging, and for that reason, I use AutoScaling to scale the axes. Nine times out of ten, it works just fine, but it seems that when the X data ranges from about 5200 to 7200 +/-, the autoscaling does not calculate well (example attached).

Autoscale range will go from 0 to 8000, leaving a large area of unplotted graph space.

I thought the original issue was that I may be plotting zeros or blanks, but I've eliminated that problem. I have yet to find another range of values that causes it, but I'm sure there's some. What is it about the way that Excel calculates its AutoScaling that I'm missing?

What do you all recommend to eliminate this problem? Manually scaling it is not really an option in this case, as I want this to be completely transparent to the user for ANY range of data.

View 9 Replies View Related

Show Missing Values In Pivot Chart (line Chart) Axis?

Apr 18, 2013

How can I add missing values to the axis in a pivot chart line chart? I have a numerical X-axis with values such as 0,1,5,8,14, etc. I have another set of Y values that correspond to the X values. If this was an XY-scatter plot I'd be able to plot X vs. Y and connect the dots for "gaps" in the X values. Since it's a pivot chart I cannot use an XY-scatter plot, I can only use a line chart. The line chart doesn't give me the ability to add the "missing" values, so it gives the impression that my data is more closely packed than it is. The data source is external to my spreadsheet, so I cannot add the values before creating the pivot table/chart.

View 1 Replies View Related

ActiveX Listbox - Enable Scrollbar / Disable Selection

Jun 20, 2014

Is it possible to disable and ActiveX listbox, but allow the scrollbar to work?

Or, prevent selections without changing the enabled property?

I'd like to populate my list with items that are for information purposes only.

View 8 Replies View Related

X & Y Scale Chart Max,min,tick Linked To Cell Values

Dec 10, 2008

I am using Jon Peltier's worksheet_change event code to try and automate chart axes.

Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address
Case "$AG$5"
ActiveSheet.ChartObjects("Chart 2").Chart.Axes(xlCategory) _
.MaximumScale = Target.Value
Case "$B$3"
ActiveSheet.ChartObjects("Chart 2").Chart.Axes(xlCategory) _
.MinimumScale = Target.Value
Case "$AG$7"
ActiveSheet.ChartObjects("Chart 2").Chart.Axes(xlCategory) _
.MajorUnit = Target.Value
Case "$L$3"
ActiveSheet.ChartObjects("Chart 2").Chart.Axes(xlValue) _
.MaximumScale = Target.Value
Case "$N$3"
ActiveSheet.ChartObjects("Chart 2").Chart.Axes(xlValue) _
.MinimumScale = Target.Value
Case "$AH$7"
ActiveSheet.ChartObjects("Chart 2").Chart.Axes(xlValue) _
.MajorUnit = Target.Value
Case Else
End Select
End Sub

However, I have some of the cells setup as formulas....but worksheet_change apparently only updates values when manually changed.

View 9 Replies View Related

Basic Chart: Set A Chart Up With The Time Been On The X - Axis

Aug 1, 2007

I got a set of data which is only 2 colums collecting data problems. The output i get is a time stamp and a fault. Im looking to set a chart up with the time been on the X - axis and number of problems per hour on the Y - axis.

View 7 Replies View Related

Changing Text Direction For ActiveX Textbox?

May 26, 2013

is there a way of changing the text direction for an ActiveX textbox? I need it to show the text in some of the boxes vertically but in other boxes horizontal.

View 7 Replies View Related

Set Chart/Graph Minimum/Maximum Scale To Nth Smallest & Largest Value

May 15, 2008

I am trying to manually format a few graphs in my sheet. I, however, leave the major units of the axes to be automatically calculated. The code that I use is given below:

ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue)
.MinimumScale = Range("Min").Value
.MaximumScale = Range("Max").Value
End With

Now what this does is that it sets the maximum of the scale exactly equal to maximum of the range being plotted and hence a few parts of my graph overlap with the border of the plot area. Is there any way in which I can round the max and min scale of y-axis to the next highest and lowest major unit respectively or may be add and subtract a value proportional to the major unit of the y-axis. I cannot add a constant in the code given above since I that does not suite my requirements.

View 2 Replies View Related

Changing X Axis Value

Nov 18, 2008

I have modified the Run as Regular Macro code from this site to only changing the x axis, select different cells and I also only used object 1 instead of the name of the chart.

The problem is that when it is run which ever value is changed last, minimum or maximum, it will turn on auto and mess it all up.

View 2 Replies View Related

VBA Changing Y-Axis Graph?

Apr 8, 2012

I am able to change the X-Axis with:

Code:

ActiveChart.Axes(xlCategory).TicketLables.Orientation = 45

How I change the Y-Axis?

View 1 Replies View Related

Chart With Two Axis

May 17, 2007

I have some simple data and i want to create a horisizontal bar chart with 2 axis (X axis) the top one showing number of stocks number up to 270 and the bottom with Market Cap up to 1,200. (See attached). I set up the chart and it looks fine but it has only one axis so in order to create a second axis i right click on the blue series (no of Stocks) and go through the motions of setting up a secondary axis. However when i do that it ends up looking like the chart to the right with the Bars Cojoined (which is not what i want) I cannot seem to achieve 2 axis with separated bars

View 3 Replies View Related

VBA Changing Axis Title Font Size And Typeface

Dec 18, 2012

I've been successful at changing the font size for the Main title and legend using these commands:

Code:
ActiveChart.ChartTitle.Font.Size = 8
ActiveChart.Legend.Font.Size = 8

But the horizontal axis has me stumped. I recorded part of this but can't get it to work:

Code:
ActiveChart.Axes(xlValue).AxisTitle.Font.Size = 8

How can I change the typeface to Times New Roman for all three and change the font size for the Axis titles? hundreds of charts to change and not enough patience to to it manually.

View 3 Replies View Related

Changing Default Option For Data Series So X & Y Axis

Oct 12, 2007

I'm trying to change the default option for the data series when graphing in Excel 2003 .... I am trying to create a line graph

Excel, by default, is putting static pressure on the x axis and the air flow on the y axis .... I need it to be the other way around

I have found out that:
By default, Excel plots whatever you have fewer of—rows or columns—as the data series

apparently it is possible to change this Excel default option, but I can't figure that out

in step 2 of the Chart Wizard, I have tried many different things, but can't get Excel to chart the Air Flow CFM on the x axis, and have static pressure values on the y axis

View 9 Replies View Related

How To Autoscale Chart Y Axis Using VBA

Apr 7, 2014

a_Y-Axis auto scale.zip

How to autoscale chart using VBA, so i can maximize the viewable area without using the default format axis on chart each time i paste new data to the table,

View 5 Replies View Related

Making Chart With X / Y And Z Axis?

Aug 13, 2002

I would like to make a graph with an x, y and z axis. All of the choices that excel gives me are only x,y graphs. How can I plot a 3-axis graph?

View 9 Replies View Related

VBA Chart - X Axis To Appear As Dates?

Jun 5, 2012

I have a simple piece of code that creates a chart using the the values in column A as the x-axis and the values in column E as the y-axis. The values in Column A are all dates in this format: mm.dd.yyyy. However, when I collect the x-values they always appear as numbers (1,2,3). Even if I format the axis to Dates, they appear as 1.00.1900, 1.02.1901, etc.

Here is the code (also, I would like a VBA solution but if this is with excel's chart tools, so be it).

Code:

Sub Macro2()
ActiveSheet.Shapes.addChart.Select
ActiveChart.ChartType = xlXYScatter
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).Name = "=""Rate of Productivity"""
ActiveChart.SeriesCollection(1).XValues = "='Sheet1'!$A$2:$A$4"
ActiveChart.SeriesCollection(1).Values = "='Sheet1'!$E$2:$E$4"
End Sub

View 4 Replies View Related

0 Value On Both X And Y Axis In Line Chart How

Jan 4, 2008

i want 0 values to start at x and y axis.
basically i want time in secs on x axis starting a 0 upto 4.4 secs

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved