Create a palette sheet and format cells as you like. Leave a blank row between them to have independent borders.
Add the code to “read” the palette and create the styles.
- Option Explicit
- Sub CreateStyles()
- Dim lr
- Dim i
- Dim StyleName, StyleCell As Range
- lr = Cells(Rows.Count, 2).End(xlUp).Row
- For i = 3 To lr Step 2
- Set StyleCell = Cells(i, 2)
- StyleName = Cells(i, 3).Value
- ' first delete
- On Error Resume Next
- ActiveWorkbook.Styles(StyleName).Delete
- On Error GoTo 0
- ' add style
- ActiveWorkbook.Styles.Add Name:=StyleName
- With ActiveWorkbook.Styles(StyleName)
- .Borders(xlBottom).Color = StyleCell.Borders(xlBottom).Color
- .Borders(xlLeft).Color = StyleCell.Borders(xlLeft).Color
- .Borders(xlRight).Color = StyleCell.Borders(xlRight).Color
- .Borders(xlTop).Color = StyleCell.Borders(xlTop).Color
- .Interior.Color = StyleCell.Interior.Color
- .Font.Color = StyleCell.Font.Color
- .NumberFormat = StyleCell.NumberFormat
- .Locked = StyleCell.Locked
- .FormulaHidden = StyleCell.FormulaHidden
- End With
- Next i
- End Sub