Saving, locking cells and others

slay0r

Board Regular
Joined
Jul 8, 2011
Messages
231
Hi there,

Using Excel 2003..

I've got a workbook called "creditstoplist" this is like a masterfile that I don't want anyone to be able to touch so what I'd like is a bit of code that will take all of the colouring out of the cells below Row 7 across the whole spreadsheet (no fill) and then to lock all the cells below this row with the password "creditstop"

Is that easy enough or will it be difficult?

Cheers guys!
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Alt+F11
Insert > Module
Paste the following code

Code:
Option Explicit
Sub ClearAndLock()
ActiveSheet.Unprotect "creditstop"
ActiveSheet.Cells.Locked = False
ActiveSheet.Range(Cells(7, 1), Cells(ActiveSheet.Rows.Count, ActiveSheet.Columns.Count)).Interior.Pattern = xlNone
ActiveSheet.Range(Cells(7, 1), Cells(ActiveSheet.Rows.Count, ActiveSheet.Columns.Count)).Locked = True
ActiveSheet.Protect "creditstop"
End Sub

Close the VB Editor
Alt+F8 to bring up the Macro window
Run ClearAndLock
 
Upvote 0
You could record a macro while doing the following:<p>Select rows 1 - 6, press Ctrl-1, go to the Protection tab and remove the protected checkmark.<p>
Select row 7.<p>
Press Ctrl-end and then Ctrl-Shift-down arrow.<p>
Press Ctrl-1, under the fill tab select "no fill", under the protection tab select "protected".<p>
On the menu, go to Tools - Protection and select either Protect Sheet or Allow users to edit ranges.<p>
Stop recording.<p>
That should be the code you need.<p><p>Nuked beat me to it and he gave you the fish. :)
 
Upvote 0

Forum statistics

Threads
1,214,948
Messages
6,122,420
Members
449,083
Latest member
Ava19

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