View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis[_3_] Dana DeLouis[_3_] is offline
external usenet poster
 
Posts: 690
Default Prevent adding rows

Try unlocking the cells first. Then allow your users to do everything but
Insert/Delete.
HTH.

Sub Macro()
ActiveSheet.Unprotect
Cells.Locked = False
ActiveSheet.Protect _
DrawingObjects:=False, _
Contents:=True, _
Scenarios:=False, _
AllowFormattingCells:=True, _
AllowFormattingColumns:=True, _
AllowFormattingRows:=True, _
AllowInsertingHyperlinks:=True, _
AllowSorting:=True, _
AllowFiltering:=True, _
AllowUsingPivotTables:=True, _
_
AllowInsertingColumns:=False, _
AllowInsertingRows:=False, _
AllowDeletingColumns:=False, _
AllowDeletingRows:=False
End Sub


--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"Rene" wrote in message
...
In VB, how do I prevent users from adding/deleting
columns and rows? I can't protect the sheet, because the
users sometimes have to adjust column widths, formats,
etc.
I played around with "AllowDeletingRows = False" but
couldn't figure it out.

Thanks!