Hi,
This is Anu & i am new to this forum. Before i proceed to the query, let me be clear that i am an illiterate when it comes to programming / vba. But i am mad about excel and love to explore things out of it.
I am currently working on the attached sheet and all I want to happen is, once data is entered and when the user tries to save the file, the cells with data should get locked. I have done this using the following code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel As Boolean)
Dim WS As Worksheet
Set WS = Sheets("Sheet1")
With WS
.Unprotect Password:="mkmumbai"
.UsedRange.Locked = True
.UsedRange.SpecialCells(xlCellTypeBlanks).Locked = False
.Protect Password:="mkmumbai"
End With
End Sub
_______________________________
However i have merged cells in column C & D (C5 to D65536) and the above code is not working on these. I know for techies this query can be very silly and will be resolved very easily.
PS: I cannot change any format in this sheet as this is followed by our company at global level in the specific pattern only.
I need this to get resolved on a very urgent basis, so ur quick response would be MUCH APPRECIATED
Bookmarks