worksheetfunction.text() and text colour

  • Thread starter Thread starter NDBC
  • Start date Start date
N

NDBC

I know worksheetfunction.text is used to set number format. Can it be used to
set font color as well.

Thanks
 
Or to be more specific. I need this code to operate so that the font color is
changed before the time is written or the time is written in red/blue
straight up. At the moment it is writing it in black first and this is
causing me an error in another part of the workbook.

If RiderNo = 1 Then
Sheets("Ironman").Cells(RiderCell.Row,
Columns.Count).End(xlToLeft).Offset(0, 1).Font.ColorIndex = 3
Sheets("Ironman").Cells(RiderCell.Row,
Columns.Count).End(xlToLeft).Offset(0, 1).NumberFormat = "[hh]:mm:ss"
Sheets("Ironman").Cells(RiderCell.Row,
Columns.Count).End(xlToLeft).Offset(0, 1) =
WorksheetFunction.Text(Sheets("Running Sheet").Cells(TRow, 4), "[hh]:mm:ss")
'calculates place for this lap
Sheets("Ironman").Cells(RiderCell.Row,
Columns.Count).End(xlToLeft).Offset(0, 1) =
WorksheetFunction.Max(Sheets("Ironman").Columns(Sheets("Ironman").Cells(RiderCell.Row, Columns.Count).End(xlToLeft).Offset(0, 1).Column)) + 1
ElseIf RiderNo = 2 Then
Sheets("Ironman").Cells(RiderCell.Row,
Columns.Count).End(xlToLeft).Offset(0, 1).Font.ColorIndex = 5
Sheets("Ironman").Cells(RiderCell.Row,
Columns.Count).End(xlToLeft).Offset(0, 1).NumberFormat = "[hh]:mm:ss"
Sheets("Ironman").Cells(RiderCell.Row,
Columns.Count).End(xlToLeft).Offset(0, 1) =
WorksheetFunction.Text(Sheets("Running Sheet").Cells(TRow, 4), "[hh]:mm:ss")
Sheets("Ironman").Cells(RiderCell.Row,
Columns.Count).End(xlToLeft).Offset(0, 1) =
WorksheetFunction.Max(Sheets("Ironman").Columns(Sheets("Ironman").Cells(RiderCell.Row, Columns.Count).End(xlToLeft).Offset(0, 1).Column)) + 1
End If
 
It was a protected worksheet problem. I hope I didn't waste too many peoples
time.

Thanks

NDBC said:
Or to be more specific. I need this code to operate so that the font color is
changed before the time is written or the time is written in red/blue
straight up. At the moment it is writing it in black first and this is
causing me an error in another part of the workbook.

If RiderNo = 1 Then
Sheets("Ironman").Cells(RiderCell.Row,
Columns.Count).End(xlToLeft).Offset(0, 1).Font.ColorIndex = 3
Sheets("Ironman").Cells(RiderCell.Row,
Columns.Count).End(xlToLeft).Offset(0, 1).NumberFormat = "[hh]:mm:ss"
Sheets("Ironman").Cells(RiderCell.Row,
Columns.Count).End(xlToLeft).Offset(0, 1) =
WorksheetFunction.Text(Sheets("Running Sheet").Cells(TRow, 4), "[hh]:mm:ss")
'calculates place for this lap
Sheets("Ironman").Cells(RiderCell.Row,
Columns.Count).End(xlToLeft).Offset(0, 1) =
WorksheetFunction.Max(Sheets("Ironman").Columns(Sheets("Ironman").Cells(RiderCell.Row, Columns.Count).End(xlToLeft).Offset(0, 1).Column)) + 1
ElseIf RiderNo = 2 Then
Sheets("Ironman").Cells(RiderCell.Row,
Columns.Count).End(xlToLeft).Offset(0, 1).Font.ColorIndex = 5
Sheets("Ironman").Cells(RiderCell.Row,
Columns.Count).End(xlToLeft).Offset(0, 1).NumberFormat = "[hh]:mm:ss"
Sheets("Ironman").Cells(RiderCell.Row,
Columns.Count).End(xlToLeft).Offset(0, 1) =
WorksheetFunction.Text(Sheets("Running Sheet").Cells(TRow, 4), "[hh]:mm:ss")
Sheets("Ironman").Cells(RiderCell.Row,
Columns.Count).End(xlToLeft).Offset(0, 1) =
WorksheetFunction.Max(Sheets("Ironman").Columns(Sheets("Ironman").Cells(RiderCell.Row, Columns.Count).End(xlToLeft).Offset(0, 1).Column)) + 1
End If



NDBC said:
I know worksheetfunction.text is used to set number format. Can it be used to
set font color as well.

Thanks
 
Back
Top