Interesting excel graph issue

dhananjaywalke

Board Regular
Joined
Jun 26, 2006
Messages
60
Hi,
I have set of information which i present in the graph format (such as Revene, Profit, Return on Capital%..etc..). I have a list of accounts to select. Once i select the account graph data for that account gets automatically selected through lookup formulae.

I have also created a macro to adjust scale & format of labels & X axis labels as below.

Sub Update_Scale()
application.ScreenUpdating = False


minscale = Range("MinScale").Value
MaxScale = Range("MaxScale").Value

minscale1 = Range("MinScale1").Value
MaxScale1 = Range("MaxScale1").Value

FormatValue = Range("FormatValue").Value

Sheets("Graphs").Select

ActiveSheet.ChartObjects("Chart 4").Activate

ActiveChart.Axes(xlValue).Select
selection.TickLabels.NumberFormat = FormatValue
ActiveChart.ChartArea.Select

ActiveChart.SeriesCollection(1).DataLabels.Select
selection.NumberFormat = FormatValue
ActiveChart.SeriesCollection(2).DataLabels.Select
selection.NumberFormat = FormatValue

With ActiveChart.Axes(xlValue)
.MinimumScale = minscale
.MaximumScale = MaxScale
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
.Crosses = xlAutomatic
.ReversePlotOrder = False
.ScaleType = xlLinear
.DisplayUnit = xlNone
End With

ActiveSheet.ChartObjects("Chart 6").Activate

ActiveChart.Axes(xlValue).Select
selection.TickLabels.NumberFormat = FormatValue
ActiveChart.ChartArea.Select

ActiveChart.SeriesCollection(1).DataLabels.Select
selection.NumberFormat = FormatValue
ActiveChart.SeriesCollection(2).DataLabels.Select
selection.NumberFormat = FormatValue

With ActiveChart.Axes(xlValue)
.MinimumScale = minscale1
.MaximumScale = MaxScale1
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
.Crosses = xlAutomatic
.ReversePlotOrder = False
.ScaleType = xlLinear
.DisplayUnit = xlNone

End With
Range("A1").Select

End Sub

Sub Update_format()
application.ScreenUpdating = False

FormatValue = Range("FormatValue").Value

Sheets("Graphs").Select

ActiveSheet.ChartObjects("Chart 4").Activate

ActiveChart.Axes(xlValue).Select
selection.TickLabels.NumberFormat = FormatValue
ActiveChart.ChartArea.Select

ActiveChart.SeriesCollection(1).DataLabels.Select
selection.NumberFormat = "0;(0);"
selection.NumberFormat = FormatValue
ActiveChart.SeriesCollection(2).DataLabels.Select
selection.NumberFormat = "0;(0);"
selection.NumberFormat = FormatValue

ActiveSheet.ChartObjects("Chart 6").Activate

ActiveChart.Axes(xlValue).Select
selection.TickLabels.NumberFormat = FormatValue
ActiveChart.ChartArea.Select

ActiveChart.SeriesCollection(1).DataLabels.Select
selection.NumberFormat = "0;(0);"
selection.NumberFormat = FormatValue
ActiveChart.SeriesCollection(2).DataLabels.Select
selection.NumberFormat = "0;(0);"
selection.NumberFormat = FormatValue



Range("A1").Select

End Sub

_____________________

Now the problem is when i select account with million # format & then account with % format. The lable format does not change. It changes if i again choose some account with format similar to earlier account.

Is there any issue with my macro.

Please help!
[/code]
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Have you tried changing the following expression from Value to NumberFormat?

FormatValue = Range("FormatValue").Value
 
Upvote 0
FormatValue = Range("FormatValue").Value

this expression is to automatically select desired number format for the graphs which may be

0.0;(0.0);"-"
OR
0.0%;(0.0%);"-"

etc.

is there any solution???
 
Upvote 0
please help me guys!!

or at least tell me other macro to auto format the chart scale & datalabels....

it would of great help
 
Upvote 0

Forum statistics

Threads
1,213,551
Messages
6,114,268
Members
448,558
Latest member
aivin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top