VBA Macro

  • Thread starter Thread starter Frank
  • Start date Start date
F

Frank

I have an Excel worksheet where some of the cells will
have data inputed into them by different people and the
other cells have formulas.

I know I can get around this by selection each individual
cell to either lock or unlock and then protect the sheet,
however I am trying to come with a VBA macro to do the job
at the end of the month.

I can't figure out the VBA statement for a locked or
unlocked cell.

Such as:
If ActiveCell.Formula Then
With Selection.Locked (VBA doesn't like this)

Thanks
Frank
 
ActiveSheet.Unprotect
With Selection
If .HasFormula Then .Locked = True
End With
ActiveSheet.Protect

Alan Beban
 
Hi

you are almost there!

it should be:

If ActiveCell.HasFormula = True Then
ActiveCell.Locked = True
End If

You just need to make it 'lock' by setting it to true and false to
'unlock'.

Tom
 
Back
Top