A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Bold deletion



 
 
Thread Tools Display Modes
  #1  
Old June 13th, 2004, 12:52 PM
Yarroll
external usenet poster
 
Posts: n/a
Default Bold deletion



Hi,


I run a macro which checks if specific cells' font is bold. If it isn't,
then the whole row gets deleted. The lines in question read:

For k = howm To 2 Step -1 '(howm =
ActiveCell.SpecialCells(xlLastCell).Row )
If Cells(k, 12).Font.Bold = False Then
Rows(k).Delete
End If
Next

Macro works fine. But it operates on large number of workbooks, and a large
portion of these workbooks frequently have nothing whatsoever in bold (ie.,
everything, except header, gets deleted). My question: is it possible to
formulate a condition whereby the macro:
- first checks if a workbook has anything in bold,
- if there is, ( at least one Cells(k, 12).Font.Bold = True ) then the macro
proceeds as before, checks each and every row
- if nothing is in bold then everything is deleted right away.

I'm not sure if I dont beat around the bush here, namely, how can a macro
check if there is anything in bold in the workbook without going through
each and every one of cells? Still it seems like a waste of resources to
look at every Cells(k, 12) if a workbook always has nothing but Font.Bold =
False.

Thanks. Best regards
Yarroll




  #3  
Old June 13th, 2004, 03:52 PM
Andy Pope
external usenet poster
 
Posts: n/a
Default Bold deletion

Hi Yarroll,

You can test to see whether no bold attributes have been set by using,

Activesheet.range("L2:L" & howm ).font.bold

which returns False if no cells are bold, True is all are bold cells and
Null if mixed bold/nobold cells.

Cheers
Andy

Yarroll wrote:
Hi,


I run a macro which checks if specific cells' font is bold. If it isn't,
then the whole row gets deleted. The lines in question read:

For k = howm To 2 Step -1 '(howm =
ActiveCell.SpecialCells(xlLastCell).Row )
If Cells(k, 12).Font.Bold = False Then
Rows(k).Delete
End If
Next

Macro works fine. But it operates on large number of workbooks, and a large
portion of these workbooks frequently have nothing whatsoever in bold (ie.,
everything, except header, gets deleted). My question: is it possible to
formulate a condition whereby the macro:
- first checks if a workbook has anything in bold,
- if there is, ( at least one Cells(k, 12).Font.Bold = True ) then the macro
proceeds as before, checks each and every row
- if nothing is in bold then everything is deleted right away.

I'm not sure if I dont beat around the bush here, namely, how can a macro
check if there is anything in bold in the workbook without going through
each and every one of cells? Still it seems like a waste of resources to
look at every Cells(k, 12) if a workbook always has nothing but Font.Bold =
False.

Thanks. Best regards
Yarroll





--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
  #4  
Old June 13th, 2004, 05:10 PM
Yarroll
external usenet poster
 
Posts: n/a
Default Bold deletion


"Andy Pope"
...
Hi Yarroll,

You can test to see whether no bold attributes have been set by using,

Activesheet.range("L2:L" & howm ).font.bold

which returns False if no cells are bold, True is all are bold cells and
Null if mixed bold/nobold cells.

Cheers
Andy

Wow Andy, thanks.
I can certainly use the tip.

Best regards,
Yarroll


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:25 PM.


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