Thread: Looping macro
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Jim Cone Jim Cone is offline
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