LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,069
Default Allow user to delete cell ranges?

I suggest you add a command button to the sheet with a caption like "Delete
selected cells'. Set the Locked property of this button to False (so it
doesn't get locked when you protect the sheet). In the click event for the
button, use VBA to unprotect the sheet, delete the selected cell(s), and
reprotect the sheet. For example,

Private Sub CommandButton1_Click()
Dim C As Range
ActiveSheet.Unprotect Password:="aaa"
For Each C In Selection
If C.Locked = False Then
C.Delete Shift:=xlUp
End If
Next C
ActiveSheet.Protect Password:="aaa", _
DrawingObjects:=True, Contents:=True
End Sub

This code looks at each cell selected be the user. If that cell is locked,
it is not deleted. Selected cells that are not locked are deleted and the
cells below shift upward.

Hope this helps,

Hutch

"Dave Mathew" wrote:

I just tried unlocking a row and it will allow me to delete the entire
row but what I am wanting to do is select and delete a specific range
of cells in a row, which it appears still isn't allowed even if I
unlock the entire row... i.e. I can only delete a row by right
clicking on the row header on the left and selecting delete, when I
select a few cells in the row and right click on the selection the
delete option is still grayed out.


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I delete all names ranges in a workbook after freezing form Wins07 Excel Discussion (Misc queries) 3 February 14th 07 06:32 PM
Delete user-defined charts Lampman Charts and Charting in Excel 2 January 24th 07 01:49 AM
delete user define setting BNT1 via OfficeKB.com Charts and Charting in Excel 3 January 18th 07 07:00 PM
delete or edit named dell ranges chris31849 Excel Discussion (Misc queries) 5 March 9th 06 10:58 PM
How do I delete all named ranges in a sheet at one time? L.Wall Excel Worksheet Functions 2 July 13th 05 03:29 PM


All times are GMT +1. The time now is 07:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"