• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Getting the error in below macro

Manan

New Member
Error :- Object does not support this property or method

What I am doing is just to increase the width of a chart via Macro instead of manually.

Code:
Sub Macro5()
'
' Macro5 Macro
'

'
  Dim myCH As Object
  Set myCH = ActiveChart.ChartArea
  myCH.Chart.Shapes.ScaleWidth 1.7459831936, msoFalse, _
  msoScaleFromBottomRight
End Sub
 
Hi,

Try below code:

Code:
Sub Macro5()

Dim myCH As Chart
  Set myCH = ActiveChart
  myCH.ChartArea.Width = 100 'put width here
End Sub

Select the chart before running the code.

Regards,
 
Hi ,

Try this :
Code:
Sub Macro5()
'
' Macro5 Macro
'
    Dim myCH_Name As String
   
    myCH_Name = ActiveChart.Parent.Name
    ActiveSheet.Shapes(myCH_Name).ScaleWidth 1.7, msoFalse, msoScaleFromBottomRight
End Sub

A simpler way is this :
Code:
Sub Macro5()
'
' Macro5 Macro
'
    Dim myCH As Object
   
    Set myCH = ActiveChart.ChartArea
    myCH.Width = myCH.Width * 1.1
End Sub
Narayan
 
Back
Top