#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
RK RK is offline
external usenet poster
 
Posts: 1
Default Looping macro

Hi!,
Can this be simplified...any help is appreciated.

Sub Checking_the_Format()

Range("A1:H1").Select
For Each cel In Selection
If cel.Font.Bold = False Then cel.Font.FontStyle = "Bold"
Next cel

Range("A2:H2").Select
For Each cel In Selection
If cel.Font.Bold = False Then cel.Font.FontStyle = "Bold"
Next cel
' Done for 5 rows
End Sub

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,726
Default Looping macro

Sub Checking_the_Format()
For Each cel In Range("A1:H5")
cel.Font.FontStyle = "Bold"
Next cel
End Sub


--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)


"RK" wrote in message
ups.com...
Hi!,
Can this be simplified...any help is appreciated.

Sub Checking_the_Format()

Range("A1:H1").Select
For Each cel In Selection
If cel.Font.Bold = False Then cel.Font.FontStyle = "Bold"
Next cel

Range("A2:H2").Select
For Each cel In Selection
If cel.Font.Bold = False Then cel.Font.FontStyle = "Bold"
Next cel
' Done for 5 rows
End Sub

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,290
Default Looping macro

Sub Checking_the_Format()
Dim cel As Excel.Range
For Each cel In Range("A1:H5").Cells
cel.Font.Bold = True
Next cel
End Sub

'Even better...

Sub Checking_the_Format_R1()
Range("A1:H5").Font.Bold = True
End Sub
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware




"RK"
wrote in message
Hi!,
Can this be simplified...any help is appreciated.
Sub Checking_the_Format()
Range("A1:H1").Select
For Each cel In Selection
If cel.Font.Bold = False Then cel.Font.FontStyle = "Bold"
Next cel

Range("A2:H2").Select
For Each cel In Selection
If cel.Font.Bold = False Then cel.Font.FontStyle = "Bold"
Next cel
' Done for 5 rows
End Sub
Thanks

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 do I email amacro? leo Excel Worksheet Functions 24 August 9th 06 02:47 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Highlight Range - wrong macro, please edit. Danny Excel Worksheet Functions 8 October 19th 05 11:11 PM
Looping Macro That adds a blank row between different part #'s fiero84 Excel Discussion (Misc queries) 5 March 25th 05 06:59 AM
macro to browse for workbook, pick up data and looping uriel78 Excel Worksheet Functions 1 March 10th 05 12:37 PM


All times are GMT +1. The time now is 03:19 PM.

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

About Us

"It's about Microsoft Excel"