S
StargateFan
I have a log that has a user input box for a start DATE. I'd like to
do the same thing for the start DAY NUMBER.
I tried modifying a date macro to input this number, but no luck so
far with any attempts. The macro below should request a number
starting from 1 onwards (1, 2, 3, 4 ... etc.) and then put that number
into cell B4. This didn't work below (naturally <sigh>) <g>:
************************************************************************
Sub RequestStartDayNumber()
'
ActiveSheet.Unprotect 'place at the beginning of the code
On Error Resume Next
ActiveSheet.ShowAllData
On Error GoTo 0
Dim vResponse As Variant
Do
vResponse = Application.InputBox( _
Prompt:="Enter a Day start number" & vbCrLf & _
"(i.e., ''1'' for display of ''Day 1'').", _
Title:="Day Start Number", _
Default:=Format(Date, "0"), _
Type:=2)
If vResponse = False Then Exit Sub 'User cancelled
Loop Until IsDate(vResponse)
With Range("B4")
.NumberFormat = "0"
.Value = CDate(vResponse)
End With
ActiveSheet.Protect 'place at the end of the code
End Sub
************************************************************************
Thanks. D
do the same thing for the start DAY NUMBER.
I tried modifying a date macro to input this number, but no luck so
far with any attempts. The macro below should request a number
starting from 1 onwards (1, 2, 3, 4 ... etc.) and then put that number
into cell B4. This didn't work below (naturally <sigh>) <g>:
************************************************************************
Sub RequestStartDayNumber()
'
ActiveSheet.Unprotect 'place at the beginning of the code
On Error Resume Next
ActiveSheet.ShowAllData
On Error GoTo 0
Dim vResponse As Variant
Do
vResponse = Application.InputBox( _
Prompt:="Enter a Day start number" & vbCrLf & _
"(i.e., ''1'' for display of ''Day 1'').", _
Title:="Day Start Number", _
Default:=Format(Date, "0"), _
Type:=2)
If vResponse = False Then Exit Sub 'User cancelled
Loop Until IsDate(vResponse)
With Range("B4")
.NumberFormat = "0"
.Value = CDate(vResponse)
End With
ActiveSheet.Protect 'place at the end of the code
End Sub
************************************************************************
Thanks. D