I am creating a new workbook Programmatically. In this newly created workbook I am trying to hide the cell content in one of the column and display the cell content on cell change event. I want to create a Worksheet event Worksheet_SelectionChange
dynamically, to track which cell is currently active in the new workbook. This newly created workbook will be a .xlsm
file as I want to add the code for the worksheet selection change event. Attaching image for reference.
Here is the code i am using :
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$A$2" Then
'Do something
End If
End Sub
I am not able to figure out how I can add a Worksheet_SelectionChange
event dynamically to a newly created workbook pragmatically. Is it possible to do it dynamically?
So can someone please help me with it .