Macro to force cell entry before running
How about propmting the user for the start date using an input box. If they
eneter a date then create the sheet otherwise dispaly a message... Something
like this...
Public Sub CopyMaster()
Dim wksMaster As Worksheet
Dim wksCopy As Worksheet
Dim strStartDate As Date
strStartDate = InputBox("Please enter the start date.")
If IsDate(strStartDate) Then
Set wksMaster = Sheets("Master")
wksMaster.Copy After:=Sheets(Sheets.Count)
Set wksCopy = ActiveSheet
wksCopy.Range("A1").Value = CDate(strStartDate)
wksMaster.Select
Set wksCopy = Nothing
Set wksMaster = Nothing
Else
MsgBox "Invalid Start Date. Please try again."
End If
End Sub
"Chance224" wrote:
I have a macro that copies a master sheet and places at the end of the
workbook by clicking a button. Is there away to have it force the user to
put the start date in a cell then continue with the macro once a value is
entered?
Thanks,
CJ
|