ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   setting Bold (https://www.excelbanter.com/excel-programming/309036-setting-bold.html)

FJ Shepley & JM Pfohl

setting Bold
 
In the macro below I have tried to make the following line bold along with
the colour but I kept getiing errors. What is the proper way of doing it?

ship.EntireRow.Font.ColorIndex = 1

I would also like to make the macro work automatically whenever the
worksheet is opened.

Thanks
Frank.





Sub macro1()
Dim ship As Range
For Each ship In Worksheets("shipped").Range("ak3",
Range("ak3").End(xlDown))
If ship = "1" Then 'yesterday
ship.EntireRow.Font.ColorIndex = 3
ElseIf ship = "0" Then 'today
ship.EntireRow.Font.ColorIndex = 1
Else: ship.EntireRow.Font.ColorIndex = 10 'tomorrow
End If
Next ship
End Sub






Tom Ogilvy

setting Bold
 
Assume Ship is a reference to a range

With ship.EntireRow.Font
.ColorIndex = 1
.bold = True
End With


Put it in the workbook_Open Event
see Chip Pearson's page on events
http://www.cpearson.com/excel/events.htm


--
Regards,
Tom Ogilvy


"FJ Shepley & JM Pfohl" wrote in message
...
In the macro below I have tried to make the following line bold along with
the colour but I kept getiing errors. What is the proper way of doing it?

ship.EntireRow.Font.ColorIndex = 1

I would also like to make the macro work automatically whenever the
worksheet is opened.

Thanks
Frank.





Sub macro1()
Dim ship As Range
For Each ship In Worksheets("shipped").Range("ak3",
Range("ak3").End(xlDown))
If ship = "1" Then 'yesterday
ship.EntireRow.Font.ColorIndex = 3
ElseIf ship = "0" Then 'today
ship.EntireRow.Font.ColorIndex = 1
Else: ship.EntireRow.Font.ColorIndex = 10 'tomorrow
End If
Next ship
End Sub









All times are GMT +1. The time now is 10:49 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com