Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

On Row Selection

Status
Not open for further replies.

JamieArvato

Technical User
Aug 5, 2004
50
0
0
GB
Is there a event which runs on selection of an entire row?

What I need is that if someone selects a row, ie to delete it it goes to cell - col A and the row they are on and tells them they are unable to select an entire row.

I would use the sheet protect but everytime I do the whole thing locks up?!?!

Thanks

 
Hi
This is a possible work around. However it also fires if all the columns are manually selected ie range A1:IV9

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Columns.Count = 256 Then
    MsgBox "Can't do that"
    Range("A" & Target.Row).Select
End If
End Sub

Happy Friday

;-)
If a man says something and there are no women there to hear him, is he still wrong? [ponder]
How do I get the best answers?
 
well there's the worksheet selection_change event, so you could use this...

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
If Target.Columns.Count = 256 Then
r = Target.Row
Cells(r, 1).Select
msg = MsgBox("You may not select an entire row.", vbExclamation, "Entire row selected")
End If
End Sub

Enjoy :)
Killian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top