target all columns in a worksheet

steve2000

New Member
Joined
Sep 28, 2017
Messages
8
Hi ! I found this vb code on the internet and I would like to know how to target all columns in a worksheet.. and not only one like we see in the code. Thanks for the help !! Private Sub Worksheet_Change(ByVal Target As Range)Application.EnableEvents = FalseIf Target.Column = 1 Thenconfirm = MsgBox(“Do you wish to confirm entry of this data?” _& vbCrLf & “You will not be allowed to change it!”, vbYesNo, “confirm Entry”)Select Case confirmCase Is = vbYesDim Cell As RangeWith ActiveSheet.Unprotect Password:=”secret″.Cells.Locked = FalseFor Each Cell In ActiveSheet.UsedRangeIf Cell.Value = “” ThenCell.Locked = FalseElseCell.Locked = TrueEnd IfNext Cell.Protect Password:=”secret″End WithCase Is = vbNoApplication.UndoEnd SelectEnd IfApplication.EnableEvents = TrueEnd Sub
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,213,551
Messages
6,114,268
Members
448,558
Latest member
aivin

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