i almost forgot vba for excel...
i need to use a click event on cell and start MYMacro...
but only in this case:
1) i can click only a single cell in column B from row 8, to the end of last filled cell
2) the cell can have a value, not blank
3) when the cell is clicked retrive the number of row and assign to MyVar (As Long)
tks
click event on cell
-
- Administrator
- Posts: 78629
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: click event on cell
Right-click the sheet tab.
Select 'View Code' from the context menu.
Copy the following code into the worksheet module:
(I assume that you have declared MyVar elsewhere)
Select 'View Code' from the context menu.
Copy the following code into the worksheet module:
Code: Select all
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Target.Column = 2 And Target.Row >= 8 And Target.Value <> "" Then
MyVar = Target.Row
End If
End Sub
Best wishes,
Hans
Hans