Friday, March 4, 2016

Run Macro When A Specific Cell Selected

Trigger Macro Or Vba Code When A Specific Cell İs Selected

          In this sample, the background color of the cells was painted different colors with  macros.

When the cells in specific range (between AR4 and AR28 cells) are selected,the macros are triggered:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case Target.Address
Case "$AR$4": Call col_one
Case "$AR$5": Call col_two
Case "$AR$6": Call col_three
Case "$AR$7": Call col_four
...
End Sub