Help with VBA issue, mysterious to me

TomCon

Active Member
Joined
Mar 31, 2011
Messages
385
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
PLEASE IGNORE...THE PROBLEM IS SOLVED (TYPO)...Sorry!
Here is VBA:
VBA Code:
Sub tst_axis()
Dim MinChrt As Double
Dim MaxChrt As Double
    Sheets("c.Wt").Select
    ActiveSheet.ChartObjects("Chart 1").Activate
    MinChrt = Application.WorksheetFunction.Floor(Application.WorksheetFunction.Min([ChWt_InstWt.Y]), 1)
    MaxChrt = Application.WorksheetFunction.Ceiling(Application.WorksheetFunction.Max([ChWt_InstWt.Y]), 1)
    ActiveChart.Axes(xlValue).MinimumScale = 174
    ActiveChart.Axes(xlValue).MaximumScale = 184
    ActiveChart.Axes(xlValue).MinumumScale = MinChrt
    ActiveChart.Axes(xlValue).MaximumScale = MaxChrt
End Sub


The following two statements from above execute without error
VBA Code:
    ActiveChart.Axes(xlValue).MinimumScale = 174
    ActiveChart.Axes(xlValue).MaximumScale = 184

However, the following statements [from above] give "Runtime error 438, object doesn't support this property or method"
VBA Code:
    ActiveChart.Axes(xlValue).MinumumScale = MinChrt
    ActiveChart.Axes(xlValue).MaximumScale = MaxChrt

In the immediate window, the variables MinChrt and MaxChrt give the same values as in the code, 174 and 184
VBA Code:
?MinChrt
 174
?MaxChrt
 184


Any idea what is going on, or how i can set these Axis properties to a variable value that is computed by the code?

Thanks!
 
Last edited:

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
SORRY PLEASE IGNORE. I see a typo that causes the problem. I requested that the post be deleted.
 
Upvote 0

Forum statistics

Threads
1,223,882
Messages
6,175,164
Members
452,615
Latest member
bogeys2birdies

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