![]() |
Macro to force cell entry before running
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 |
Macro to force cell entry before running
We always prefer that you post your macro here for comments
Sub checkg9() If Not IsDate(Range("g9")) Then MsgBox "fix date" End Sub -- Don Guillett SalesAid Software "Chance224" wrote in message ... 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 |
Macro to force cell entry before running
The following is the Macro used. How do I insert your macro to run with
this? I would like is to force an entry into cell BR15 if it is blank and then continue to copy the sheet. Sub Copy_Click() ' ' Sheets(" Master").Copy After:=Sheets(ActiveWorkbook.Worksheets.Count) ActiveSheet.Range("AC3").Value = "Enter Date" ActiveSheet.Range("K7").Value = "Enter Well Number" ActiveSheet.Range("AY104").Formula = "=AY101+'" & ActiveSheet.Previous.Name _ & "'!AY104" MsgBox ("Please Change The DATE & WELL NUMBER. Thank You & Stay Safe! Remember You Can ONLY Use - For Date Entries") End Sub Thanks, CJ "Don Guillett" wrote: We always prefer that you post your macro here for comments Sub checkg9() If Not IsDate(Range("g9")) Then MsgBox "fix date" End Sub -- Don Guillett SalesAid Software "Chance224" wrote in message ... 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 |
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 |
All times are GMT +1. The time now is 12:00 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com