+ Reply to Thread
Results 1 to 3 of 3

Font Strike identification does not work as expected

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    01-02-2007
    Location
    Australia NSW
    MS-Off Ver
    2013
    Posts
    494

    Font Strike identification does not work as expected

    Private Sub UserForm_Initialize()
    Application.ScreenUpdating = False
    Me.ComboBox1.Clear ' Remove and pre-existing values from the list
    Dim lastcell As Long
    Dim myrow As Long
    'On Error Resume Next
    lastcell = Worksheets("DATA").Cells(Rows.Count, "A").End(xlUp).Row ' Look in column A
    With ActiveWorkbook.Worksheets("DATA")
    .Select
        For myrow = 1 To lastcell ' Look in rows 1 to the last row in Column A
        If .Cells(myrow, 1).Font.Strikethrough = False And .Cells(myrow, 1).Value <> "ROLL#" Then ' <== If font is Strikethrough then do NOT USE
        If Sheets("MAIN_PAGE").Range("F1").Value = .Cells(myrow, 2).Value Then
        ' Show ONLY required records that match F1 value, do NOT have a Strikethrough font  & does not equal ROLL#
            Me.ComboBox1.AddItem .Cells(myrow, 1).Value ' Values to add to Combobox. STILL get all Strikethrough values ????
                  End If
                  End If
                      Next
                             End With
    Sheets("MAIN_PAGE").Activate
    Application.ScreenUpdating = True
    End Sub
    The above highlighted line does not prevent Strikethrough fonts from being populated, but I can figure out why?

  2. #2
    Forum Contributor
    Join Date
    01-02-2007
    Location
    Australia NSW
    MS-Off Ver
    2013
    Posts
    494

    Re: Font Strike identification does not work as expected

    bump it up for response....

  3. #3
    Forum Contributor
    Join Date
    01-02-2007
    Location
    Australia NSW
    MS-Off Ver
    2013
    Posts
    494

    Re: Font Strike identification does not work as expected

    Feeling that the correct syntax was used as :
    If .Cells(myrow, 1).Font.Strikethrough = False And .Cells(myrow, 1).Value <> "ROLL#" Then ' <== If font is Strikethrough then do NOT USE
    , but Excel did not work with it.
    I changed the line to
    If .Cells(myrow, 1).Font.Regular = True And .Cells(myrow, 1).Value <> "ROLL#" Then ' <== If font is Regular(Bold otherwise) then do NOT USE
    .
    This syntax works as expected.
    Glitch??

    I can work with this instead, and i simply modified the CD from Strikethrough to Regular instead.

+ Reply to Thread

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