![]() |
Activate button when row selected.
I have a button on a protected sheet which will allow the user to delete
a row. The button enabled feature is set to false initially. I would like to enable the button when the user selects a row or multiple rows. Then they can delete the selected rows & the sheet will be protected again. Any help on this would be greatly appreciated, Regard's, Johnnyb --- Message posted from http://www.ExcelForum.com/ |
Activate button when row selected.
Wouldn't this mean that you (Excel) would have to continually check to
see if anything has been selected on the worksheet? I think it would be easier to always have the button ENABLED, and add code as part of the deletion routine to check that the user has selected valid and/or entire rows for deletion. Sean "Just press the off switch, and go to sleep!" *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Activate button when row selected.
right click on the sheet tab and select view code. Paste in code like
this: Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Address = Target.EntireRow.Address Then CommandButton1.Enabled = True Else CommandButton1.Enabled = False End If End Sub -- Regards, Tom Ogilvy "Johnnyb " wrote in message ... I have a button on a protected sheet which will allow the user to delete a row. The button enabled feature is set to false initially. I would like to enable the button when the user selects a row or multiple rows. Then they can delete the selected rows & the sheet will be protected again. Any help on this would be greatly appreciated, Regard's, Johnnyb --- Message posted from http://www.ExcelForum.com/ |
Activate button when row selected.
Nice one Tom, Thanx
Tom Ogilvy wrote: *right click on the sheet tab and select view code. Paste in cod like this: Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Address = Target.EntireRow.Address Then CommandButton1.Enabled = True Else CommandButton1.Enabled = False End If End Sub -- Regards, Tom Ogilvy "Johnnyb " wrote in message ... I have a button on a protected sheet which will allow the user t delete a row. The button enabled feature is set to false initially. would like to enable the button when the user selects a row or multipl rows. Then they can delete the selected rows & the sheet will b protected again. Any help on this would be greatly appreciated, Regard's, Johnnyb --- Message posted from http://www.ExcelForum.com/ -- Message posted from http://www.ExcelForum.com |
All times are GMT +1. The time now is 06:49 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com