Detecting Row Selection

N

Nigel

Hi All
Is there a 'simple' way of detecting if a user selects an entire row in a
worksheet that can be used to trigger an event?

I have a need to control users who wish to delete an entire row by way of
the CTRL- sequence.

On another related matter, if a worksheet is protected (all cells) and an
autofilter is in place, is there a way to detect that the user is clicking
the autofilter ?

TIA
 
D

Dave Peterson

You can use a worksheet_selectionchange event.

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = Target.EntireRow.Address Then
MsgBox "whole row(s) selected"
End If
End Sub

Rightclick on the worksheet tab that should have this behavior and select view
code. Paste this into the code window.

But I'm not sure if that will help.

Maybe you could train them to do a shift-spacebar (to select the entirerow),
then ctrl-hypen.

=======
For #2. Maybe you could tie into the worksheet_calculate event to see what the
filters are.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top