Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
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
Join bold and non-bold text in one cell bkincaid Excel Discussion (Misc queries) 3 March 21st 06 12:58 AM
Set certain rows to Bold jerry chapman[_2_] Excel Programming 5 February 2nd 05 02:02 AM
remove bold from cell ref headers Angiew Excel Discussion (Misc queries) 1 January 22nd 05 01:09 AM
Show or hide rows when text is bold or italic Sophisticated Penguin Excel Programming 4 December 1st 04 09:45 AM
Ideal Code deleting rows/based on bold text Samm Excel Programming 1 April 9th 04 03:20 AM


All times are GMT +1. The time now is 02:29 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"