+ Reply to Thread
Results 1 to 4 of 4

Delete rows with bold or italic text

  1. #1
    Registered User
    Join Date
    08-24-2004
    Posts
    14

    Exclamation Delete rows with bold or italic text

    Hi,

    I have a spreadsheet a large spreadsheet. I need to look at the text in column D and if there is any cell with bold or italicized text in column D, I want the entire row to be deleted.

    Thanks in advance for any help!

    Robbin

  2. #2

    Re: Delete rows with bold or italic text

    Robbin:

    Copy this sub procedure into a module in your workbook.

    Sub DeleteRows()

    Dim UsedRows As Long
    Dim RowCnt As Long

    UsedRows = ActiveSheet.UsedRange.Rows.Count

    For RowCnt = 1 To UsedRows

    Select Case Selection.Item(RowCnt).Font.FontStyle

    Case "Bold", "Italic"

    Rows(RowCnt).Delete

    End Select

    Next RowCnt

    End Sub

    Once you have it there, select the entire row(D) and run the macro,
    "DeleteRows", from your macros list. On the odd chance that you don't
    understand any of this, reply and I'll talk you through it in more
    detail.

    Mark


  3. #3
    John
    Guest

    Re: Delete rows with bold or italic text

    Hi Robbin,

    Have a go with this (it's based on a continuous column of values and stops
    when it gets to a blank ("") cell):

    Sub CheckForBold()

    Dim wks As Worksheet
    Dim iRow As Integer

    iRow = 1
    Set wks = Application.ActiveSheet

    Do Until wks.Cells(iRow, 4).Value = ""
    If wks.Cells(iRow, 4).Font.Bold = True Then
    wks.Rows(iRow).Delete
    Else
    iRow = iRow + 1
    End If
    Loop

    End Sub

    Best regards

    John




    "MAYDAY" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi,
    >
    > I have a spreadsheet a large spreadsheet. I need to look at the text
    > in column D and if there is any cell with bold or italicized text in
    > column D, I want the entire row to be deleted.
    >
    > Thanks in advance for any help!
    >
    > Robbin
    >
    >
    > --
    > MAYDAY
    > ------------------------------------------------------------------------
    > MAYDAY's Profile:
    > http://www.excelforum.com/member.php...o&userid=13548
    > View this thread: http://www.excelforum.com/showthread...hreadid=478043
    >




  4. #4
    John
    Guest

    Re: Delete rows with bold or italic text

    Sorry, forgot the italics:

    Sub CheckForBold()

    Dim wks As Worksheet
    Dim iRow As Integer

    iRow = 1
    Set wks = Application.ActiveSheet

    Do Until wks.Cells(iRow, 4).Value = ""
    If wks.Cells(iRow, 4).Font.Bold = True Or _
    wks.Cells(iRow, 4).Font.Italic = True Then
    wks.Rows(iRow).Delete
    Else
    iRow = iRow + 1
    End If
    Loop

    End Sub

    "John" <[email protected]> wrote in message
    news:[email protected]...
    > Hi Robbin,
    >
    > Have a go with this (it's based on a continuous column of values and stops
    > when it gets to a blank ("") cell):
    >
    > Sub CheckForBold()
    >
    > Dim wks As Worksheet
    > Dim iRow As Integer
    >
    > iRow = 1
    > Set wks = Application.ActiveSheet
    >
    > Do Until wks.Cells(iRow, 4).Value = ""
    > If wks.Cells(iRow, 4).Font.Bold = True Then
    > wks.Rows(iRow).Delete
    > Else
    > iRow = iRow + 1
    > End If
    > Loop
    >
    > End Sub
    >
    > Best regards
    >
    > John
    >
    >
    >
    >
    > "MAYDAY" <[email protected]> wrote in
    > message news:[email protected]...
    >>
    >> Hi,
    >>
    >> I have a spreadsheet a large spreadsheet. I need to look at the text
    >> in column D and if there is any cell with bold or italicized text in
    >> column D, I want the entire row to be deleted.
    >>
    >> Thanks in advance for any help!
    >>
    >> Robbin
    >>
    >>
    >> --
    >> MAYDAY
    >> ------------------------------------------------------------------------
    >> MAYDAY's Profile:
    >> http://www.excelforum.com/member.php...o&userid=13548
    >> View this thread:
    >> http://www.excelforum.com/showthread...hreadid=478043
    >>

    >
    >




+ 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