Hello, all,
I've been reading the forums, but I can't seem to find anything that is specifically relevant to what I'm trying to do.
What I'm trying to write is code for a class module which is triggered whenever a value is changed on a worksheet using the Worksheet_Change event which compares two values on the sheet. It seems to work when stepping through, but it doesn't get triggered at all when control is given back to the User.
When I try declaring the new worksheet as an "MZWorksheet" which would have that Worksheet_Change event property, even with the WithEvents statement, it doesn't recognize "MZWorksheet.Add"
If there's another, better way of doing this, please let me know!
Code
'Creating the object (In a different module)
Dim MZ As New MZWorkSheet
Set MZ = ThisWorkbook.MZWorksheet.Add(After:=Worksheets("Raw Data"))
MZ.Name = "MZ Sheet"
MZ.Visible = True
[...]
'MZWorksheet Class Module code
Public WithEvents aSheet As Worksheet
Property Set Sheet(sht As Worksheet)
Set aSheet = sht
End Property
Private Sub aSheet_Change(ByVal Target As Range)
'See if the flag for the MZ has been set; otherwise, do nothing.
[...]
End Sub
Display More