Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
Show or hide rows when text is bold or italic
Thank you all very much - most helpful!
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How copy a cell with mixed text (regular, bold, italic) with a fo. | Excel Discussion (Misc queries) | |||
Font/Color/Bold/Italic Remain Same | Excel Discussion (Misc queries) | |||
Formula to identify character formatting (bold, italic, etc) | Excel Worksheet Functions | |||
change format of cells (bold, italic) based on one cell's answer | Excel Discussion (Misc queries) | |||
How to apply both Italic & Bold in Header & Footer? | Excel Discussion (Misc queries) |