JohnGow383
Board Regular
- Joined
- Jul 6, 2021
- Messages
- 141
- Office Version
- 2013
- Platform
- Windows
I have a very simple label that reads a date from a hidden cell in the sheet. The hidden cell is AB1. I am having trouble trying to get the caption of ActiveX Label1 to change value when the value of AB1 changes.
This is really quite easy with UserForms but with ActiveX I don't see any easy options. I can get it to change by clicking or moving mouse over but that's not what I want.
This is the code I've tried within a Worksheet_Change module.
Any help much appreciated. Thanks
This is really quite easy with UserForms but with ActiveX I don't see any easy options. I can get it to change by clicking or moving mouse over but that's not what I want.
This is the code I've tried within a Worksheet_Change module.
VBA Code:
'Dynamically change ActiveX Label1 Caption to match cell value of AB1
Dim MyLabel As OLEObject
Set MyLabel = Sheet1.OLEObjects("Label1")
If Not Intersect(Target, Sheet1.Range("AB1")) Is Nothing Then
MyLabel.Object.Caption = Format(Target.Value, "mmm d, yyyy")
End If
End Sub
Any help much appreciated. Thanks