However this is not really what i need as new worksheets are created automatically and during this process i want to add the code to do this at design time. If that makes sense.
Hi Dave,
If you're looking to do this for row 5 from column B on, then tactps' solution can be amended a bit to this.
It covers text, numeric values and formulas, and executes upon selection of the sheet(s).
Code:
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
On Error Resume Next
[B5:IV5].SpecialCells(xlCellTypeConstants).Font.Bold = True
[B5:IV5].SpecialCells(xlCellTypeFormulas).Font.Bold = True
End Sub
I need to apply the formatting programmaticaly. As new worksheets will be added depending on dates. Therefore when a month changes a new worksheet is created and also then i want to format the cells also.
I want to avoid manually selecting and setting the formatting manually.
Not sure I understand.
You want to format non empty cells in row 5 (except column A) on all sheets, including any newly created ones, as bold font?
If that's right then the code provided will do that. No need to select & manually format. The only thing that needs to be selected is the sheet one time to execute the formatting code, then it stays. (And the sheet selection can be done programatically if you won't be looking at them before printing or something like that.)
If this isn't what you want can you rephrase your request?
We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel
Which adblocker are you using?
Disable AdBlock
Follow these easy steps to disable AdBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the icon in the browser’s toolbar. 2)Click on the "Pause on this site" option.
Go back
Disable AdBlock Plus
Follow these easy steps to disable AdBlock Plus
1)Click on the icon in the browser’s toolbar. 2)Click on the toggle to disable it for "mrexcel.com".
Go back
Disable uBlock Origin
Follow these easy steps to disable uBlock Origin
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.
Go back
Disable uBlock
Follow these easy steps to disable uBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.