Click the Security button on the Visual Basic toolbar to √ "Trust for Visual Basic project" Under Trusted Publishers tab in the Pop-up Security dialog box.
Alt+f11 Open the VBE editor, click the Menu tool-reference, and in the Pop-up Reference-vbaproject dialog box, select the item that references Microsoft Visual Basic 6.0 Extensibility.
Create a new module named: YYZX
In the Sheet1 (SHEET1) Code window, paste the following code:
Sub refers to the cell string code and executes ()
Dim Sr, Ksh, en
On Error Resume Next
Ksh = ThisWorkbook.VBProject.VBComponents ("Yyzx"). Codemodule.procbodyline ("Yyrgzx", Vbext_pk_proc)
If Err.Number = Then ' To determine if the YYRGZX process exists
sr = "Sub yyrgzx ()" & VbCrLf & Cells (1, 1) & VbCrLf & "End Sub"
With ThisWorkbook.VBProject.VBComponents ("Yyzx"). CodeModule
. addfromstring SR
End With
Call reference
Else
With ThisWorkbook.VBProject.VBComponents ("Yyzx"). CodeModule
Ksh =. ProcBodyLine ("Yyrgzx", Vbext_pk_proc)
En =. ProcCountLines ("Yyrgzx", Vbext_pk_proc)
. DeleteLines Ksh, Zh-1
End With
sr = "Sub yyrgzx ()" & VbCrLf & Cells (1, 1) & VbCrLf & "End Sub"
With ThisWorkbook.VBProject.VBComponents ("Yyzx"). CodeModule
. addfromstring SR
End With
Call reference
End If
End Sub
Sub Reference ()
Call YYRGZX
End Sub
Using the buttons on the Form toolbar, drag out a button named: Reference cell content execution, specifying: "Sheet1. Reference cell string code and execute" macro.
6 viewing effects, when A1 cell contents change, clicking the contents of a reference cell executes, depending on the string code in the cell A1, resulting in different effects.