ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Suppresing Insert Row functionality (https://www.excelbanter.com/excel-discussion-misc-queries/145025-suppresing-insert-row-functionality.html)

John

Suppresing Insert Row functionality
 
Hi,

Using the Change Event, how can i stop users inserting columns when the
Cellpointer is in column C please?

Thanks

John


Mike H

Suppresing Insert Row functionality
 
John,

I'm not sure about the worksheet_change event but it can be done with the
selection_change event by disbaling the insert rows option every time column
3 is the active column:-

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
As Range)
If ActiveCell.Column = 3 Then
With Application.CommandBars("Worksheet Menu Bar").Controls("&Insert")
.Controls("&Rows").Enabled = False
End With
Else
With Application.CommandBars("Worksheet Menu Bar").Controls("&Insert")
.Controls("&Rows").Enabled = True
End With
End If
End Sub

Mike

"John" wrote:

Hi,

Using the Change Event, how can i stop users inserting columns when the
Cellpointer is in column C please?

Thanks

John


Mike H

Suppresing Insert Row functionality
 
John,

Forgot the righ-click method of insert so add this:-

Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target
As Range, Cancel As Boolean)
If ActiveCell.Column = 3 Then Cancel = True
End Sub

Mike

"John" wrote:

Hi,

Using the Change Event, how can i stop users inserting columns when the
Cellpointer is in column C please?

Thanks

John



All times are GMT +1. The time now is 08:26 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com