Excel VBA - How to Change Shape Color on Click @InAnOfficeExcelVBA
Excel VBA - How to Change Shape Color on Click  @InAnOfficeExcelVBA
Uploaded March 2025 | Updated December 2026, 3 hours ago
In this tutorial, learn how to use Excel VBA to change the color of a shape when it's clicked, while resetting the colors of all other shapes on the worksheet. This simple VBA script allows you to add interactive features to your Excel workbook, making it easier to visually highlight shapes as you click on them.

Make sure to like, subscribe, and click the bell icon to get notified of more Excel tips and VBA tutorials!

#ExcelVBA #ExcelShapes #ExcelTutorial #ExcelTips #excelautomationtutorial


Dim lastClickedShape As String

Sub Shape_Clicked()
Dim shp As Shape
Dim clickedShape As Shape
Dim clickedShapeName As String
clickedShapeName = ActiveSheet.Shapes(Application.Caller).Name ' Get the name of the clicked shape

' Loop through all shapes on the active sheet
For Each shp In ActiveSheet.Shapes
If shp.Name = clickedShapeName Then
' Change the color of the clicked shape
shp.Fill.ForeColor.RGB = RGB(0, 255, 0) ' Change to Green
Else
'Reset the color of all other shapes
shp.Fill.ForeColor.RGB = RGB(255, 0, 0) ' Reset other shapes to Red
End If
Next shp
End Sub
Excel VBA - How to Change Shape Color on ClickExcel Tips and Tricks #56 How To Save Selection As PDF In Excel?How to Make a Beautiful Excel ChartExcel Tips and Tricks #22 How to Fill a Range with FormulaHow to Create a Doughnut Chart in ExcelExcel Tips and Tricks #74 How to hide the cell values in Excel without hiding cellsHow to Link Data in Excel from One Sheet to AnotherHow to Copy and Paste Multiple Cells in ExcelHow to Fit Excel Data within a Cell using Shrink to FitExcel Tips and Tricks #65 How to Unlock Specific Cells in a Protected Sheet in ExcelMastering Excel: Interface OverviewExcel VBA How to Show UserForm When Excel File Opens
InAnOffice |

Excel VBA - How to Change Shape Color on Click

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER