Thats awesome! Thank you for the comments in there as well.
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
End With
With Selection.Font
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
End With
With Selection.Font
.Name = "Calibri"
.Size = 10
.ThemeColor = xlThemeColorLight1
End With
End Sub
Is that code up there simplified from below?
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With Selection.Font
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
With Selection.Font
.Name = "Calibri"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontMinor
End With
End Sub
I am trying to add a Black_Fill and Clear button to my context menu but I keep adding buttons everything i open and close the WB.
Sub ButtonOne()
Dim ContextMenu As CommandBar
Call DeleteButtons
Set ContextMenu = Application.CommandBars(Application.CommandBars("cell").Index + 3)
With ContextMenu.Controls.Add(Type:=msoControlButton, Before:=1)
.OnAction = "'" & ThisWorkbook.Name & "'!Black_Fill"
.FaceId = 1003
.Caption = "Format"
.Tag = "mct1"
End With
Call ButtonTwo
End Sub
Sub ButtonTwo()
Dim ContextMenu As CommandBar
Set ContextMenu = Application.CommandBars(Application.CommandBars("cell").Index + 3)
With ContextMenu.Controls.Add(Type:=msoControlButton, Before:=2)
.OnAction = "'" & ThisWorkbook.Name & "'!Clear"
.FaceId = 266
.Caption = "Clear!"
.Tag = "mct1"
End With
End Sub
Sub DeleteButtons()
Dim ContextMenu As CommandBar
Dim ctrl As CommandBarControl
Set ContextMenu = Application.CommandBars("Cell")
For Each ctrl In ContextMenu.Controls
If ctrl.Tag = "mct1" Then
ctrl.Delete
End If
Next ctrl
End Sub
Private Sub Workbook_Activate()
Call ButtonOne
End Sub
Private Sub Workbook_Deactivate()
Call DeleteButtons
End Sub
I thought I knew what i was doing..
-A
Bookmarks