Have one Macro react to whatever cantrol calls it
Hello,
I had a user ask me if there was a way to create a custom checkbox control
for use in Excel. Dick Kusleika was kind enough to suggest this macro and
it worked with great success.
Sub CheckCircle()
With Sheet1.Shapes(1).TextFrame
If .Characters.Text = Chr$(252) Then
.Characters.Text = ""
Else
.Characters.Text = Chr$(252)
End If
End With
End Sub
The user was very happy and with him not knowing anything about VBA, he
asked if I could modify a spreadsheet for him. Not thinking, I accepted.
Turns out it is actually three specification spreadsheets that each have a
minimum of 100 of such custom checkbox controls.
You can see that this would be beyond tedious to have to make a macro for
each control in the above fashion.
Is there a way to make this ONE macro respond to which ever custom control
that calls it? How can you interrogate what control called the macro?
something like:
iCallingControl=CallingControl(item)
Sheet1.Shapes(iCallingControl).TextFrame
Sad I know but does my problem make sense? Is there a spiffy solution?
Any help would be appreciated.
Jim
|