Suppresing Insert Row functionality

J

John

Hi,

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

Thanks

John
 
M

Mike H

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
 
M

Mike H

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top