VBA Marco to Change Display Units Not Working

Joined
May 24, 2012
Messages
1
Reaction score
0
I am creating a vba macro to change a charts units based on a word change in a cell $C$2. Although the macro look simple it is not working. I am getting Run-time error '424' object required on the 3rd line of the script, and Run-time error 91 Object variable or With block variable not set on the 4th line. Any help is greatly appreciated.

Private Sub Worksheet_Calculate()
Range("c2").Select
ActiveCell.Text = "Million Barrels per Day"
ActiveChart.ChartObjects("Chart 2").Chart.Axes(xlValue).DisplayUnit = xlThousands
End Sub
 
Joined
Jun 5, 2012
Messages
1
Reaction score
0
ActiveCell.Text is for getting the cell value only. If you want to set it, use ActiveCell.FormulaR1C1 = "Million Barrels per Day"
Cheers:)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top