locking columns

arnoldmiranda

Board Regular
Joined
Jul 15, 2002
Messages
233
Hi,
I need help with an excel file, the file contains certain parameters from A5 to A15 in B6 we type the agent name and below that if he/she passed or failed in the parameters listed in column A2 to A15 subsequently for every other agent we will capture similar data in column C,D etc
While updating an agents entry in column C it's imperative that no changes are made in column B etc once the data has been entered
Can a macro be written which will lock the entire columnB when an entry is made in cell B15, etc etc

thanks
 

Some videos you may like

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

FryerTuck

New Member
Joined
Jan 23, 2004
Messages
37
Put the following in theVBA Objects Sheet that you want to protect. when something is put into row 15, it will unprotect the sheet, change the locked indicator for that column to TRUE; then re-protect the sheet. The column will now be locked. I used "asdf" as the password, change it to whatever you want.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = 15 Then
ActiveSheet.Unprotect "asdf"
Columns(Target.Column).Locked = True
ActiveSheet.Protect "asdf", DrawingObjects:=True, Contents:=True, Scenarios:=True
End If
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,123,402
Messages
5,601,475
Members
414,452
Latest member
Dannysamworth

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
Top