Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Show or hide rows when text is bold or italic

Hi, sorry to bother everyone again but I'm desperate... is there a way to
show or hide rows (like you would with autofilter) but based on the
formatting of the cells rather than the content? I need to be able to show
only bold rows or only italic rows. Many thanks,
SP
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default Show or hide rows when text is bold or italic

Start in the column you want to evaluate. It stops when it hits a blank cell.
Sub Macro1()
Do Until ActiveCell.Value = ""
If Selection.Font.Bold = True Then
ThisAddress = ActiveCell.Address
ActiveCell.Rows("1:1").EntireRow.Select
Selection.EntireRow.Hidden = True
Range(ThisAddress).Select
ActiveCell.Offset(1, 0).Range("A1").Select
Else
ActiveCell.Offset(1, 0).Range("A1").Select
End If
Loop
End Sub
Hope it helps
"Sophisticated Penguin" wrote:

Hi, sorry to bother everyone again but I'm desperate... is there a way to
show or hide rows (like you would with autofilter) but based on the
formatting of the cells rather than the content? I need to be able to show
only bold rows or only italic rows. Many thanks,
SP

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 42
Default Show or hide rows when text is bold or italic

The following code should do what u want.


lastrow = Cells(Rows.Count, 1).End(xlUp).Row + 1
Range("a1").Select

Do Until ActiveCell.Row = lastrow

If Selection.Font.Bold = True Then
ActiveCell.Rows.Hidden = True
ActiveCell.Offset(rowoffset:=1).Activate
Else: ActiveCell.Offset(rowoffset:=1).Activate

End If

Loop

HTH
Devin
-----Original Message-----
Hi, sorry to bother everyone again but I'm desperate...

is there a way to
show or hide rows (like you would with autofilter) but

based on the
formatting of the cells rather than the content? I need

to be able to show
only bold rows or only italic rows. Many thanks,
SP
.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Show or hide rows when text is bold or italic

I do not know of any built-in ways to do such a thing, but you could
write VBA code to loop through the UsedRange.Rows and if .font.bold or
..font.italic in the first cell in the row is true then do a
Rows.Hidden = True

Short example:

Sub HideBoldRows()
For Each Element In ActiveSheet.UsedRange.Rows
If Element.Range("A1").Font.Bold = True Then _
Element.Rows.Hidden = True
Next Element
End Sub


Billkamm
irc.24oz.net #Excel

Sophisticated Penguin wrote in message ...
Hi, sorry to bother everyone again but I'm desperate... is there a way to
show or hide rows (like you would with autofilter) but based on the
formatting of the cells rather than the content? I need to be able to show
only bold rows or only italic rows. Many thanks,
SP

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Show or hide rows when text is bold or italic

Thank you all very much - most helpful!
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How copy a cell with mixed text (regular, bold, italic) with a fo. Burkhard Excel Discussion (Misc queries) 1 November 25th 09 11:29 AM
Font/Color/Bold/Italic Remain Same dberger16 Excel Discussion (Misc queries) 2 January 21st 09 08:36 PM
Formula to identify character formatting (bold, italic, etc) alphaorionis Excel Worksheet Functions 3 July 1st 07 11:19 PM
change format of cells (bold, italic) based on one cell's answer Jabi Excel Discussion (Misc queries) 4 May 25th 06 12:33 PM
How to apply both Italic & Bold in Header & Footer? Regina Man Excel Discussion (Misc queries) 1 September 26th 05 09:35 AM


All times are GMT +1. The time now is 02:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"