ElieCollins
New Member
- Joined
- Feb 1, 2024
- Messages
- 1
- Office Version
- 365
- 2021
- 2019
- 2016
- Platform
- Windows
I got an excel template from a sister site, and i wanted to add a color to a VBA Code that was already written, an i got an error message type 13 mismatch on the WhoAmI function.
could anyone help please. by the way i'm by far not a good coder.
thanks
Sub ChangeColor()
Dim WhoAmI As String, sh As Shape
WhoAmI = Application.Caller
With ActiveSheet.Shapes(WhoAmI).Fill.ForeColor
Select Case .RGB
Case vbWhite
.RGB = vbGreen
Case vbGreen
.RGB = vbYellow
Case vbYellow
.RGB = vbBlue
Case vbBlue
.RGB = vbRed
Case vbMagenta
.RGB = vbMagenta
Case Else
.RGB = vbWhite
End Select
End With
End Sub
could anyone help please. by the way i'm by far not a good coder.
thanks
Sub ChangeColor()
Dim WhoAmI As String, sh As Shape
WhoAmI = Application.Caller
With ActiveSheet.Shapes(WhoAmI).Fill.ForeColor
Select Case .RGB
Case vbWhite
.RGB = vbGreen
Case vbGreen
.RGB = vbYellow
Case vbYellow
.RGB = vbBlue
Case vbBlue
.RGB = vbRed
Case vbMagenta
.RGB = vbMagenta
Case Else
.RGB = vbWhite
End Select
End With
End Sub