i am trying to refer to a cell and take that cell value and put it into the title of a graph that i have created using a macro. A simple example of the code i am using is
the number in cell A1 has 3 decimal places. how can i make the title of the graph have 2 decimal places? i tried changing the format of A1 to 2 decimal places before using the code above but it did not work. thanks for any help in advance.
Code:
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.text = Sheets("Sheet1").Range("A1")
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.text = "time (sec)"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.text = "G"
End With