capture column delete

starl

Administrator
Joined
Aug 16, 2002
Messages
6,081
Office Version
  1. 365
Platform
  1. Windows
Is there a way of capturing a delete column? According to the help, a Worksheet_Change will ignore it.. is there anything else I can try?

thanks
 
Oh sorry,

Tom, my code seems like yours for deselecting when columns or rows are selected. Sorry, I noticed it right now.

Suat
 
Upvote 0

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Wow! HI Oz :biggrin:

the deal is - I only want to block them from CERTAIN columns.
 
Upvote 0
ok,

This one will prevent user deleting columns 3 and 7 by selecting all column with one click.

VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  If Target.Rows.Count = 65536 And (Target.Column = 3 Or Target.Column = 7) Then
    Application.Goto Range(Cells(Target.Row, Target.Column), Cells(Target.Row, Target.Column))
  End If
End Sub

you can add more column index into second condition part:

(Target.Column = 3 Or Target.Column = 7 Or ... Or ...)

Hope it works like you need this time.

Suat
 
Upvote 0
Solution
I always amaze myself by overcomplicating things. By the time I was finished with this poor fellow we would have had to rename the application. Good solution Smoz.
 
Upvote 0
well, my mind was set on one direction, too. But, oz is right - it's not a good idea to mess w/menus....
that's why I post here - other points of view :biggrin:
 
Upvote 0

Forum statistics

Threads
1,214,912
Messages
6,122,200
Members
449,072
Latest member
DW Draft

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top