Hello,
I found this site and I have found all the example files really helpful. I never knew there was so much that could be done with excel.
I am a complete beginner, so please bear with what might be such an easy solution.
I have found this excellent pop up calendar (attached). I would like to use it with my existing spreadsheet which is not a problem.
The trouble is I have this code to protect the cells once data is entered
[VBA]Private Sub Worksheet_Change(ByVal Target As Range)
Dim Ans As Variant
If Application.Intersect(Target, Range("B1:B5")) Is Nothing Then Exit Sub
If Target.Locked = True Then
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
MsgBox "Changes are not allowed in this cell"
Exit Sub
End If
Ans = MsgBox("Are you sure you want to enter " & Target.Value, vbQuestion + vbYesNo, "Confirm Entry")
If Ans = vbYes Then
ActiveSheet.Unprotect
Target.Locked = True
ActiveSheet.Protect contents:=True
End If
End Sub[/VBA]
I have tried to combine these so that simply put I can click on the cell, the calendar pops up, I choose the date, then I get the "are you sure ?" message, click yes or no. If I click yes cell locks, or no and I can re-enter.
Sorry if I have rambled on. What I did was to paste one code beneath the other but I was getting errors.
Any help would be appreciated. (and any pointer of how "generally" two different commands would normally go together.
Thanks for looking.
georgedaws