Update Macro to Filter for Font.Regular Rather than Array
Results 1 to 5 of 5

Thread: Update Macro to Filter for Font.Regular Rather than Array
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Jul 2019
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Update Macro to Filter for Font.Regular Rather than Array

    I was recently asked to modify an existing macro (written by a former employee) returning rows from an Array in column 4 to return only the rows in column 4 that are not blank and in Font.Regular
    This macro compiles data from numerous reports into an overall monthly report.The number of rows vary between various workbooks, and there are a variable number of blank rows in the subject column. The (working) macro looks like this:
    With mybook.Worksheets(3)
    .AutoFilterMode = False
    lRow = .Range("I" & .Rows.Count).End(xlUp).Row
    .Range("$A$14:$BA$" & lRow).AutoFilter Field:=4, Criteria1:=Array( _
    "FEE ON LABOR", "FEE ON OTHER DIRECT COSTS", "NON-BILLABLE COST", _
    "CAPPED INDIRECTS"), Operator:=xlFilterValues

    My (non-functional) macro looks like this:
    With mybook.Worksheets(3)
    .AutoFilterMode = False
    lRow = .Range("I" & .Rows.Count).End(xlUp).Row
    .Range("$A$14:$BA$" & lRow).AutoFilter Field:=4, Criteria1:=_"Font.Regular",
    Operator:=xlFilterValues

    Help Please!

  2. #2
    Board Regular igold's Avatar
    Join Date
    Jul 2014
    Location
    Delray Beach, FL, USA
    Posts
    2,313
    Post Thanks / Like
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)

    Default Re: Update Macro to Filter for Font.Regular Rather than Array

    Hi MRHein,

    Welcome to the MrExcel Forum.

    I have poked around a bit and I don't think it can be done. At the very least, I think you would have to use the Font.FontStyle property to return the word "Regular". I tried a couple of things but could get it to work. Perhaps one of the more knowledgeable forum members will chime in with a solution.
    ​igold

    I'm a drinker with a coding problem...

    All code is written with Excel 2010 - Please test all code on a backup copy of your data.


  3. #3
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    25,638
    Post Thanks / Like
    Mentioned
    445 Post(s)
    Tagged
    45 Thread(s)

    Default Re: Update Macro to Filter for Font.Regular Rather than Array

    You could try
    Code:
       With mybook.Worksheets(3)
          .AutoFilterMode = False
          lrow = .Range("I" & .Rows.Count).End(xlUp).Row
          For i = 15 To lrow
             .Cells(i, "BB").Value = .Cells(i, 4).Font.FontStyle = "Regular"
          Next i
          .Range("A14:BB" & lrow).AutoFilter 4, "<>"
          .Range("A14:BB" & lrow).AutoFilter 54, True
       End With
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

  4. #4
    New Member
    Join Date
    Jul 2019
    Posts
    3
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Update Macro to Filter for Font.Regular Rather than Array

    Thanks! That worked!

  5. #5
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    25,638
    Post Thanks / Like
    Mentioned
    445 Post(s)
    Tagged
    45 Thread(s)

    Default Re: Update Macro to Filter for Font.Regular Rather than Array

    You're welcome & thanks for the feedback
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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