number format

birdman

Board Regular
Joined
Oct 11, 2005
Messages
187
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
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
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.
 

Some videos you may like

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

birdman

Board Regular
Joined
Oct 11, 2005
Messages
187
i figure i can use the round function but is that really necessary?
 

Watch MrExcel Video

Forum statistics

Threads
1,119,142
Messages
5,576,318
Members
412,716
Latest member
thviid
Top