Results 1 to 5 of 5

worksheetfunction.text() and font colour

Threaded View

  1. #1
    Registered User
    Join Date
    08-03-2009
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    19

    worksheetfunction.text() and font colour

    The following code does everything I need it to except for some reason it is not sending the font colour through first or the font colour is getting overwritten. I have formula in other worksheets that are counting the red and the blue to determine which rider in a team it is. For some reason the time sent to "B Grade" worksheet is ending up in black font. Can anyone explain to me why this is occuring.

    I am using worksheet function.text because I am working with elapsed times that could be over 24hrs. I was wondering if the default text colour for the worksheet.text() function is black and if it could be changed.

    Thanks

    Dim Name As Variant
    Dim Start As Date
    Dim ID As String
    Dim RiderCell As Range
    Dim Team As Integer
    Dim RiderSet As Variant
    Dim TagCheck As Variant
    Dim RiderNo As Integer
    Dim RidersRange As Range
    Dim TRow As Integer
    Dim Test As Variant
    
    ElseIf Sheets("Running Sheet").Cells(TRow, 3) >= 200 And Sheets("Running Sheet").Cells(TRow, 3) <= 299 Then
                
                Set RidersRange = Sheets("B Grade").Range("H5:" & Range("H5").End(xlDown).Address)
                'find row number where team number is
                Set RiderCell = RidersRange.Find(Sheets("Running Sheet").Cells(TRow, 3), , xlValues)
                        If RiderNo = 1 Then
                        Sheets("B Grade").Cells(RiderCell.Row, Columns.Count).End(xlToLeft).Offset(0, 1).Font.ColorIndex = 3
                        Sheets("B Grade").Cells(RiderCell.Row, Columns.Count).End(xlToLeft).Offset(0, 1).NumberFormat = "[hh]:mm:ss"
                        Sheets("B Grade").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("B Grade").Cells(RiderCell.Row, Columns.Count).End(xlToLeft).Offset(0, 1) = WorksheetFunction.Max(Sheets("B Grade").Columns(Sheets("B Grade").Cells(RiderCell.Row, Columns.Count).End(xlToLeft).Offset(0, 1).Column)) + 1
                        ElseIf RiderNo = 2 Then
                        Sheets("B Grade").Cells(RiderCell.Row, Columns.Count).End(xlToLeft).Offset(0, 1).Font.ColorIndex = 5
                        Sheets("B Grade").Cells(RiderCell.Row, Columns.Count).End(xlToLeft).Offset(0, 1).NumberFormat = "[hh]:mm:ss"
                        Sheets("B Grade").Cells(RiderCell.Row, Columns.Count).End(xlToLeft).Offset(0, 1) = WorksheetFunction.Text(Sheets("Running Sheet").Cells(TRow, 4), "[hh]:mm:ss")
                        Sheets("B Grade").Cells(RiderCell.Row, Columns.Count).End(xlToLeft).Offset(0, 1) = WorksheetFunction.Max(Sheets("B Grade").Columns(Sheets("B Grade").Cells(RiderCell.Row, Columns.Count).End(xlToLeft).Offset(0, 1).Column)) + 1
                        End If
                    Set RidersRange = Nothing
                    Set RiderCell = Nothing
                    RiderNo = 0
    Last edited by NDBC; 09-05-2009 at 01:23 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1