0

I was searching for how to change decimal, using VBA and I found the excellent answer below.

https://stackoverflow.com/a/32462504/9653254

However, for my graph, it is a scatter graph. So I need to change decimal on x-axis. Above code only change y-axis. Could you let me know how to change deciaml on x-axis?

Thank you in advance.

Dim obj     As Object
For Each obj In ActiveSheet.ChartObjects
   With obj.Chart.Axes(xlValue)
      .TickLabels.NumberFormat = "0.00"
   End With
Next obj

End Sub
2
  • Also use NumberFormat with Axes(xlCategory)
    – Ahmed AU
    Nov 28, 2019 at 15:42
  • Thank you for your comment. I solved it!! many thanks.
    – Jin.w.Kim
    Nov 28, 2019 at 16:10

1 Answer 1

0

I found answer, thanks to @Ahmed AU

The code is the below. Thank you for your comment.

Sub xydecimal()

  Dim obj     As Object
For Each obj In ActiveSheet.ChartObjects
   With obj.Chart.Axes(xlValue)
   .TickLabels.NumberFormat = "0.00"
      End With
   With obj.Chart.Axes(xlCategory)
    .TickLabels.NumberFormat = "0.00"            
   End With
Next obj

End Sub

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.