PC Review


Reply
Thread Tools Rate Thread

Disable Delete/Insert Entire Column

 
 
=?Utf-8?B?SlJfMDYwNjIwMDU=?=
Guest
Posts: n/a
 
      16th Aug 2006
I have a spreadsheet which has some macros associated with it and need to
make sure that columns are not deleted or inserted. For the case where the
context menu is used to delete or insert a columns, the following code works
because one has to select the entire column:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Rows.Count = 65536 Then
ActiveSheet.Protect
Else
ActiveSheet.Unprotect
End If
End Sub
(The above code places the spreadsheet in the protection mode if an
entire
column is selected and unprotects it when a cell or range of cells is
selected.)

However, this does not work if someone decides to delete or insert using the
Excel menu. I don't want to keep the sheet in a protected mode since this is
too restrictive, but I do need a way to protect the columns. Any help with
this is appreciated.
 
Reply With Quote
 
 
 
 
Thomas A. Rowe
Guest
Posts: n/a
 
      16th Aug 2006
Suggest you post this the Excel newsgroup.

--
==============================================
Thomas A. Rowe
Microsoft MVP - FrontPage
==============================================
Agents Real Estate Listing Network
http://www.NReal.com
==============================================


"JR_06062005" <(E-Mail Removed)> wrote in message
news:E759DE5F-896E-4F2E-99E2-(E-Mail Removed)...
>I have a spreadsheet which has some macros associated with it and need to
> make sure that columns are not deleted or inserted. For the case where the
> context menu is used to delete or insert a columns, the following code works
> because one has to select the entire column:
>
> Private Sub Worksheet_SelectionChange(ByVal Target As Range)
> If Target.Rows.Count = 65536 Then
> ActiveSheet.Protect
> Else
> ActiveSheet.Unprotect
> End If
> End Sub
> (The above code places the spreadsheet in the protection mode if an
> entire
> column is selected and unprotects it when a cell or range of cells is
> selected.)
>
> However, this does not work if someone decides to delete or insert using the
> Excel menu. I don't want to keep the sheet in a protected mode since this is
> too restrictive, but I do need a way to protect the columns. Any help with
> this is appreciated.



 
Reply With Quote
 
=?Utf-8?B?SlJfMDYwNjIwMDU=?=
Guest
Posts: n/a
 
      16th Aug 2006
Sorry about that.

"Thomas A. Rowe" wrote:

> Suggest you post this the Excel newsgroup.
>
> --
> ==============================================
> Thomas A. Rowe
> Microsoft MVP - FrontPage
> ==============================================
> Agents Real Estate Listing Network
> http://www.NReal.com
> ==============================================
>
>
> "JR_06062005" <(E-Mail Removed)> wrote in message
> news:E759DE5F-896E-4F2E-99E2-(E-Mail Removed)...
> >I have a spreadsheet which has some macros associated with it and need to
> > make sure that columns are not deleted or inserted. For the case where the
> > context menu is used to delete or insert a columns, the following code works
> > because one has to select the entire column:
> >
> > Private Sub Worksheet_SelectionChange(ByVal Target As Range)
> > If Target.Rows.Count = 65536 Then
> > ActiveSheet.Protect
> > Else
> > ActiveSheet.Unprotect
> > End If
> > End Sub
> > (The above code places the spreadsheet in the protection mode if an
> > entire
> > column is selected and unprotects it when a cell or range of cells is
> > selected.)
> >
> > However, this does not work if someone decides to delete or insert using the
> > Excel menu. I don't want to keep the sheet in a protected mode since this is
> > too restrictive, but I do need a way to protect the columns. Any help with
> > this is appreciated.

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Insert a function in an entire column Emece Microsoft Excel Misc 3 29th Jan 2009 06:11 PM
Disable Menu Items Insert/Delete Entire Column(s) =?Utf-8?B?SlJfMDYwNjIwMDU=?= Microsoft Excel Programming 4 17th Aug 2006 07:25 PM
Find Column heading and then Delete entire column Kobayashi Microsoft Excel Programming 4 17th Oct 2005 09:09 PM
Disabling "Entire &row/&column" in Delete/Insert Cell Gap Microsoft Excel Programming 1 6th Mar 2005 03:42 PM
Disable entire row delete on certain sheet =?Utf-8?B?SmFzb24=?= Microsoft Excel Programming 4 15th Apr 2004 05:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:52 AM.