Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 ++++++++++++++++++++++++++++ -- MrAle ------------------------------------------------------------------------ MrAle's Profile: http://www.excelforum.com/member.php...o&userid=26868 View this thread: http://www.excelforum.com/showthread...hreadid=401073 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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" wrote in message ... 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
Posted to microsoft.public.excel.programming
|
|||
|
|||
Remove all rows with bold text
Bob Phillips Thank you! That did the trick, :) -- MrAle ------------------------------------------------------------------------ MrAle's Profile: http://www.excelforum.com/member.php...o&userid=26868 View this thread: http://www.excelforum.com/showthread...hreadid=401073 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Join bold and non-bold text in one cell | Excel Discussion (Misc queries) | |||
Set certain rows to Bold | Excel Programming | |||
remove bold from cell ref headers | Excel Discussion (Misc queries) | |||
Show or hide rows when text is bold or italic | Excel Programming | |||
Ideal Code deleting rows/based on bold text | Excel Programming |