I'm attempting to cover the red arrow indicating a comment exists in that cell by drawing a shape in VBA, but I can't seem to get the shape's .SchemeColor to match the exact background .Color property I have the cells set to.
It's a type of grey, Debug.Print'ing that cells background .Color returns 14277081.
The closest I've come is setting .SchemeColor of my shape to 22.
(yes I see my shape isn't exactly covering, will fix in post)
Here's the subroutine:
If anyone knows how I can get my shape to exactly blend in with my color I would appreciate it. Here's a link to my entire .xlsm file. The coding I'm doing is in Worksheet_Change in Sheet1 (DAVTemplate) and can be found by scrolling to the bottom. Typing in any of the white cells will draw the shape in the corresponding C column.
https://dl.dropbox.com/u/2421809/DAV Template.xlsm
PS I know I can alter the red comment arrow in Excel settings but it needs to be done in VBA.
It's a type of grey, Debug.Print'ing that cells background .Color returns 14277081.
The closest I've come is setting .SchemeColor of my shape to 22.
(yes I see my shape isn't exactly covering, will fix in post)
Here's the subroutine:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
' Only trigger worksheet change if the previous value doesn't match
If Not previousValue = Target.Value Then
' Automatically inserts the date and logger if anything is altered
Func.UnlockAll
Application.EnableEvents = False
'Range("B" & Target.Row).Value = Int((999 - 100 + 1) * Rnd + 100)
'Range("C" & Target.Row).Comment.Text Text:="test"
With Range("C" & Target.Row)
.Value = Format(Date, "dd/mm/yyyy")
.ClearComments
.AddComment CStr(Time)
.Comment.Shape.TextFrame.AutoSize = True
shpW = 6
shpH = 4
Set shpCmt = Shapes.AddShape(msoShapeRightTriangle, .Offset(0, 1).Left - shpW, .Top, shpW, shpH)
End With
With shpCmt
.Flip msoFlipVertical
.Flip msoFlipHorizontal
.Fill.ForeColor.SchemeColor = 22
.Fill.Visible = msoTrue
.Fill.Solid
.Line.Visible = msoFalse
End With
Range("D" & Target.Row) = Func.UserName
Application.EnableEvents = True
Func.LockAll
' When From/To values change on the current worksheet (default only allows DAVTemplate)
' the below code will politely error correct the user
If Not buttonfreeze Then
If (Not Range("M" & Target.Row) = "" And Not Range("N" & Target.Row) = "") And Not butt******* Then
If Range("O" & Target.Row) < 0 Then
MsgBox ("Meters cannot be negative")
Cells(Target.Row, Target.Column).Value = ""
Else
If Not Intersect(Target, Range("M:N")) Is Nothing And Target.Count = 1 Then
If (Target = Range("M" & Target.Row) Or Target = Range("N" & Target.Row)) Then
If Not Range("O" & Target.Row).Value = 1 Then
confirmation = MsgBox("Are you sure?", vbYesNo, "Confirmation")
If Not confirmation = vbYes Then
Cells(Target.Row, Target.Column).Value = ""
End If
End If
End If
End If
End If
End If
End If
End If
End Sub
If anyone knows how I can get my shape to exactly blend in with my color I would appreciate it. Here's a link to my entire .xlsm file. The coding I'm doing is in Worksheet_Change in Sheet1 (DAVTemplate) and can be found by scrolling to the bottom. Typing in any of the white cells will draw the shape in the corresponding C column.
https://dl.dropbox.com/u/2421809/DAV Template.xlsm
PS I know I can alter the red comment arrow in Excel settings but it needs to be done in VBA.