![]() |
worksheetfunction.text() and text colour
I know worksheetfunction.text is used to set number format. Can it be used to
set font color as well. Thanks |
worksheetfunction.text() and text colour
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(Sh eets("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(Sh eets("Ironman").Cells(RiderCell.Row, Columns.Count).End(xlToLeft).Offset(0, 1).Column)) + 1 End If "NDBC" wrote: I know worksheetfunction.text is used to set number format. Can it be used to set font color as well. Thanks |
worksheetfunction.text() and text colour
It was a protected worksheet problem. I hope I didn't waste too many peoples
time. Thanks "NDBC" wrote: 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(Sh eets("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(Sh eets("Ironman").Cells(RiderCell.Row, Columns.Count).End(xlToLeft).Offset(0, 1).Column)) + 1 End If "NDBC" wrote: I know worksheetfunction.text is used to set number format. Can it be used to set font color as well. Thanks |
All times are GMT +1. The time now is 09:03 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com