Application.Caller with Command Buttons?
I'm not sure how the topleftcell and backcolor relate, but since you're in that
button's click procedure, you know what button started the macro:
Option Explicit
Private Sub CommandButton1_Click()
MsgBox Me.CommandButton1.TopLeftCell.Address
End Sub
or...
Option Explicit
Private Sub CommandButton1_Click()
MsgBox Me.CommandButton1.TopLeftCell.Address
Me.CommandButton1.BackColor = &HFF&
End Sub
RBee wrote:
I'm trying ot use following line of code...
ActiveSheet.Shapes(Application.Caller).TopLeftCell .Row
...to generically determine the row in which a button was clicked (which
initiates a macro). The code works great for Buttons created with the Forms
toolbar, but does not work for Command Buttons created with the Controls
Toolbox toolbar (which, I assume is ActiveX). I need to use the latter type
so I can also programatically change its BackColor.
The error seems to be Error 2023.
Any way around this?
--
Dave Peterson
|