Hi
I am working on some code to make sure that certain columns are hidden and password protected when a user saves a file and have got this far but got stuck - can anyone help me with the part I'm missing please?
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Sheets("Headcount").Select
if.Columns("C").Hidden.. - this is the line I can't get to work - I want it to determine if Column C is already hidden then just save but if not then the column should be hidden and the sheet should be locked with the password in the section below?
Columns("C:E").Select
Selection.EntireColumn.Hidden = True
Range("A1").Select
ActiveSheet.Protect Password:="password"
End Sub
Bookmarks