![]() |
Detecting Row Selection
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 -- Cheers Nigel |
Detecting Row Selection
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. Nigel wrote: 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 -- Cheers Nigel -- Dave Peterson |
All times are GMT +1. The time now is 05:43 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com