+ Reply to Thread
Results 1 to 4 of 4

Remove all rows with bold text

  1. #1
    Registered User
    Join Date
    09-01-2005
    Posts
    2

    Remove all rows with bold text

    Hello,

    I need to create a macro that removes all rows with none bold text. Text can be in any cell.

    Down below is a macro I created, but it only removes if the selected cell contains none bold stuff.

    I'm kinda new to VBA so a working macro would be greate!
    Thanks

    ++++++++++++++++++++++++++++
    Sub Testi()

    On Error GoTo quit
    If Selection.Font.Bold = False Then
    Selection.EntireRow.Delete
    End If

    quit:

    End Sub
    ++++++++++++++++++++++++++++

  2. #2
    DaveO
    Guest

    RE: Remove all rows with bold text

    How many columns are you looking at and is it if the whole line isn't bold or
    if certain cells on the row aren't bold?

    "MrAle" wrote:

    >
    > Hello,
    >
    > I need to create a macro that removes all rows with none bold text.
    > Text can be in any cell.
    >
    > Down below is a macro I created, but it only removes if the selected
    > cell contains none bold stuff.
    >
    > I'm kinda new to VBA so a working macro would be greate!
    > Thanks
    >
    > ++++++++++++++++++++++++++++
    > Sub Testi()
    >
    > On Error GoTo quit
    > If Selection.Font.Bold = False Then
    > Selection.EntireRow.Delete
    > End If
    >
    > quit:
    >
    > End Sub
    > ++++++++++++++++++++++++++++
    >
    >
    > --
    > MrAle
    > ------------------------------------------------------------------------
    > MrAle's Profile: http://www.excelforum.com/member.php...o&userid=26868
    > View this thread: http://www.excelforum.com/showthread...hreadid=401073
    >
    >


  3. #3
    Bob Phillips
    Guest

    Re: Remove all rows with bold text

    This will delete any row that is not all bold. So if one cell is bold,
    another is not, it's gone.

    Sub DeleteNotBold()
    Dim iLastRow As Long
    Dim iLastCol As Long
    Dim i As Long
    Dim j As Long
    Dim fbold As Boolean

    iLastRow = Cells.Find(What:="*", _
    After:=Range("A1"), _
    SearchOrder:=xlByRows, _
    SearchDirection:=xlPrevious).Row

    For i = iLastRow To 1 Step -1
    iLastCol = Cells(i, Columns.Count).End(xlToLeft).Column
    fbold = True
    For j = 1 To iLastCol
    If Not Cells(i, j).Font.Bold Then
    fbold = False
    Exit For
    End If
    Next j
    If Not fbold Then Rows(i).Delete
    Next i
    End Sub


    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "MrAle" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello,
    >
    > I need to create a macro that removes all rows with none bold text.
    > Text can be in any cell.
    >
    > Down below is a macro I created, but it only removes if the selected
    > cell contains none bold stuff.
    >
    > I'm kinda new to VBA so a working macro would be greate!
    > Thanks
    >
    > ++++++++++++++++++++++++++++
    > Sub Testi()
    >
    > On Error GoTo quit
    > If Selection.Font.Bold = False Then
    > Selection.EntireRow.Delete
    > End If
    >
    > quit:
    >
    > End Sub
    > ++++++++++++++++++++++++++++
    >
    >
    > --
    > MrAle
    > ------------------------------------------------------------------------
    > MrAle's Profile:

    http://www.excelforum.com/member.php...o&userid=26868
    > View this thread: http://www.excelforum.com/showthread...hreadid=401073
    >




  4. #4
    Registered User
    Join Date
    09-01-2005
    Posts
    2
    Bob Phillips

    Thank you! That did the trick,

+ 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