0

I have defined a UserBox which opens on the double click of cells within a specified range. I do this with simple intersection checking in Worksheet_BeforeDoubleClick(). I have a row of header tags in my sheet and I want a label within the opened UserBox to display "Opened with X" where X is the header of the column the cell is in. For example, if cell C9 is double clicked, I want to to display the text of the header located in cell C2. I know how to apply the contents of an arbitrary cell to a label within the UserBox, but I'm not sure how to extract the row and column of the cell that was clicked.

Pawel Czyz
  • 1,651
  • 4
  • 17
  • 21
taurus
  • 470
  • 7
  • 22

2 Answers2

2

Try:

Option Explicit

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

    Dim Column As Long, Row As Long

    Column = Target.Column
    Row = Target.Row

End Sub
Error 1004
  • 7,877
  • 3
  • 23
  • 46
0

I figured this out. I can simply call ActiveCell.Row and ActiveCell.Column.

taurus
  • 470
  • 7
  • 22