スプレッドシートで任意のセルをマウスの右クリックをしたときの、位置データを取得するには、どうしたらいいんでしょうか?何処のセルかって情報を取得したいんです。
一口にスプレッドシートといっても、いろいろな種類があるので。。。(^_^;
とりあえず、Microsoft Spreadseet Control v10 と仮定して回答。
Private Sub Spreadsheet1_BeforeContextMenu(ByVal x&, ByVal y&, ByVal Menu As OWC10.ByRef, ByVal Cancel As OWC10.ByRef)
Cancel.Value = True
End Sub
Private Sub Spreadsheet1_MouseUp(ByVal Button&, ByVal Shift&, ByVal x&, ByVal y&)
If Button = vbRightButton Then
Debug.Print x, y, Spreadsheet1.ActiveCell.Address(False, False, xlA1)
End If
End Sub
ツイート | ![]() |