StargateFan expressed precisely :
I have this script to ask user for a start date which works perfectly:
----------------------------------------------------------------------------------------------------------------------
Sub StartDate()
ActiveSheet.Unprotect 'place at the beginning of the code
Dim vResponse As Variant
Do
vResponse = Application.InputBox( _
Prompt:="Enter the start date for this sheet that
you need for the 2-week on, 2-week off, Par-A-Gon schedule:" & vbCrLf
& vbCrLf & _
"(Excel is flexible; you can pretty much type any
date format and it'll know what date you mean!)", _
Title:="Overtime Start Date", _
Default:=Format(Date, "mmm dd, yyyy"), _
Type:=2)
If vResponse = False Then Exit Sub 'User cancelled
Loop Until IsDate(vResponse)
Range("A2").Value = Format(CDate(vResponse), "mmm dd, yyyy")
ActiveSheet.Protect ' place at end of code
End Sub
----------------------------------------------------------------------------------------------------------------------
What user input box would ask for dosage that could then be dumped
into a protected cell with this custom format (to be dumped into
protected cell E1):
"''Dose'' = "@" tablets in a.m. & p.m."
Thank you!
Use the same InputBox method as you did for getting the date. Just ask
for the number of tablets and check the user's input for
IsNumeric(vResponse). Then dump this into E1 as follows:
Range("E1").Value = "Dose = " & vResponse & " tablets in a.m. & p.m."
<FWIW
As for the protect/unprotect that you're doing, it can be avoided by
setting the arg 'userinterfaceonly' to TRUE when protecting the sheet.
This will let you edit locked cells with code.
--
Garry
Free usenet access at
http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc