tjdickinson
Board Regular
- Joined
- Jun 26, 2021
- Messages
- 61
- Office Version
- 365
- Platform
- Windows
I have a relatively long macro which I am trying to optimize for efficiency. In a number of places, there is code such as:
which applies the same format to different ranges depending on the Sheet name. I feel like this could be optimized both visually and for the running of the code, but I'm not sure how to do it.
Thanks for any help you can offer!
VBA Code:
' Format Name header
If ActiveSheet.Name <> "Toezicht" Then
With Range("A1")
.Interior.ThemeColor = xlThemeColorDark2
.Font.Name = nameHeaderFont
.Font.Size = nameHeaderSize
.Font.ThemeColor = xlThemeColorLight2
.RowHeight = nameHeaderHeight
End With
Else
With Range("A1, A6, A11, A16")
.Interior.ThemeColor = xlThemeColorDark2
.Font.Name = nameHeaderFont
.Font.Size = nameHeaderSize
.Font.ThemeColor = xlThemeColorLight2
.RowHeight = nameHeaderHeight
End With
End If
Thanks for any help you can offer!