|
|
Chart Macro Help Needed
Hello,
I have a chart named "VR" located on it's own tab, where a user can go and,
via drop down box, select data range A or data range B to view on the graph.
I've used this for a long time successfully, but now I have a need where the
data scale is disparate between the two, and I need to set specific ranges
for the Y axis based on the selection of view A or view B.
the data is on a separate sheet, and I have formulas in place to return the
correct Y scale range based on the selection of A or B, and have named the
output of those Y1min for the Y axis minimum value, Y1Max for the y axis
maximum value, and Munit for the major unit value.
I've attempted to write the macro below to adjust the chart ranges on the VR
chart tab. However it faults out and states that it is "unable to set the
major unit property of the axis class".
Could anyone provide any guidance on either fixing this or providing an
alternative solution? Using the automatic selection will not work for
various reasons with my graph design.
Thanks for the help,
bruce
Private Sub Worksheet_Calculate()
Sheets("VR").Select
ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue)
.MinimumScale = Y1min
.MaximumScale = Y1max
.MinorUnitIsAuto = True
.MajorUnit = Munit
.Crosses = xlCustom
.CrossesAt = 0
.ReversePlotOrder = False
.ScaleType = xlLinear
.DisplayUnit = xlNone
End With
End Sub
|
|
0
|
|
|
|
Reply
|
Utf
|
12/16/2009 3:12:01 PM |
|
The variables Y1min, Y1max and Munit are not populated by the routine and is
thus empty. You need to fill these with you formula results first like this
(change to reference you location of course).
Sheets("VR").Select
Y1min=Sheets("Sheet1").Range("A1")
Y1max=Sheets("Sheet1").Range("A2")
Munit=Sheets("Sheet1").Range("A3")
ActiveChart.Axes(xlValue).Select
--
If this helps, please remember to click yes.
"brumanchu" wrote:
> Hello,
> I have a chart named "VR" located on it's own tab, where a user can go and,
> via drop down box, select data range A or data range B to view on the graph.
> I've used this for a long time successfully, but now I have a need where the
> data scale is disparate between the two, and I need to set specific ranges
> for the Y axis based on the selection of view A or view B.
>
> the data is on a separate sheet, and I have formulas in place to return the
> correct Y scale range based on the selection of A or B, and have named the
> output of those Y1min for the Y axis minimum value, Y1Max for the y axis
> maximum value, and Munit for the major unit value.
>
> I've attempted to write the macro below to adjust the chart ranges on the VR
> chart tab. However it faults out and states that it is "unable to set the
> major unit property of the axis class".
>
> Could anyone provide any guidance on either fixing this or providing an
> alternative solution? Using the automatic selection will not work for
> various reasons with my graph design.
>
> Thanks for the help,
> bruce
>
> Private Sub Worksheet_Calculate()
> Sheets("VR").Select
> ActiveChart.Axes(xlValue).Select
> With ActiveChart.Axes(xlValue)
> .MinimumScale = Y1min
> .MaximumScale = Y1max
> .MinorUnitIsAuto = True
> .MajorUnit = Munit
> .Crosses = xlCustom
> .CrossesAt = 0
> .ReversePlotOrder = False
> .ScaleType = xlLinear
> .DisplayUnit = xlNone
> End With
> End Sub
|
|
0
|
|
|
|
Reply
|
Utf
|
12/16/2009 5:37:01 PM
|
|
|
1 Replies
253 Views
(page loaded in 0.034 seconds)
Similiar Articles: Reference a table field in VBA - microsoft.public.access ...VBA Pivot Table Change Criteria - Help?! - microsoft.public.excel ... Chart Macro Help Needed - microsoft.public.excel.misc Every Value in the Page Field Using a Macro ... EXcel Chart Size Probelm with Printer - Please Help - microsoft ...Record a macro while doing the above to get the ... and sometimes many per page -this iis why I needed ... Help - Excel Help forum; Excel 2007 Help; EXCEL 2007 Chart Printing ... Convert Pivot Table to Values in Macro - microsoft.public.excel ...VBA Pivot Table Change Criteria - Help?! - microsoft.public.excel ... Chart Macro Help Needed - microsoft.public.excel.misc Every Value in the Page Field Using a Macro ... Macro to change pivot field with latest value - microsoft.public ...Chart Macro Help Needed - microsoft.public.excel.misc Every Value in the Page Field Using a Macro ... VBA Pivot Table Change Criteria - Help ... Reference a table field in ... Timeline chart in Access - microsoft.public.access.reports ...Chart Macro Help Needed - microsoft.public.excel.misc Hello, I have a chart named "VR" located on it's own ... Help!! importing a text file into access with vba ... Macro on a Pivot Table - microsoft.public.excel.miscVBA Pivot Table Change Criteria - Help?! - microsoft.public.excel ... Chart Macro Help Needed - microsoft.public.excel.misc Every Value in the Page Field Using a Macro ... How to add another y-axis range into chart? - microsoft.public ...Chart Macro Help Needed - microsoft.public.excel.misc... and I need to set specific ranges for the Y axis ... formulas in place to return the correct Y scale range ... Automatic drop-down selection? - microsoft.public.access.forms ...Chart Macro Help Needed - microsoft.public.excel.misc... named "VR" located on it's own tab, where a user can go and, via drop down box ... Using the automatic selection ... macro to remove item between parenthesis - microsoft.public.word ...Chart Macro Help Needed - microsoft.public.excel.misc Macro Help/Duplicate Items + Insert Rows + Sum - microsoft.public ... You could use a Pivot ... How to call a COM add-in function from macro in Excel 2007 ...... microsoft.public.excel ... microsoft.public.excel.worksheet.functions - page 4 Macro help - add column selection Utf 1 ... Help needed to add a Chart with a macro in Excel ... Excel - Excel Charts; Macro Help Needed To Create Drop-down Menu ...Excel Charts; Macro Help Needed To Create Drop-down Menu And Timeline Selection - Hello Group I am creating performance metric... - Free Excel Help Excel - Pivot Table Email Macro Needed - I generate... - Free ...Pivot Table Email Macro Needed - I generate a daily pivot table report for 7 persons... - Free Excel Help Help needed to add a Chart with a macro in Excel 2007 - Windows ...Help needed to add a Chart with a macro in Excel 2007, Windows Software, Application software and office software for Windows. Microsoft Office, WordPerfect, etc.. Microsoft Excel: Help needed with Pivot table macro to remove data ...excel.itags.org: Microsoft Excel question: Help needed with Pivot table macro to remove data, created at:Fri, 23 May 2008 02:53:00 GMT with 401 bytes, last updated ... Visual Basic :: Word Table Macro - Help! - BigResource: Webmaster ...Problem With VB Macro In Excel For Pivot Table; VB Excel Help Needed: Building A Table Via A Macro; Order Table In Excel Macro Command. VB Macro For Excel Pivot Table Refresh 7/16/2012 12:43:46 PM
|
|
|
|
|
|
|
|
|