Good morning,

In my Inventory work book I have made a command button to close the day. each worksheet is named on the current date of the month (format MM-DD-YYYY). This procedure is to be done on the same (end of) day or the next day of the current worksheet date. If by mistake the operator closes the day on the same date, the new file name appears as MM-DD-YYYY(2), which can create lot of problems if it goes unnoticed. My code provides only for closing the day on the next day of the current worksheet date. My present code does not have the provision to correct this mistake or show an error message, which i am unable to solve.

secondly, say if there is a one day holiday or a days gap in taking inventory, and the day close function is performed then the previous day (or the dates in between) is not shown and the file name appears as the current date, which again if it goes unnoticed can create further problems.

I have tried a lot of code combinations with dialog boxes and error boxes but non give me a satisfactory result.

What i need is,

1. If the day is closed on the same day or on the next day, both ways the next copied worksheet name should show as the next working day date.(without showing any error or a dialog box or input box.)

2. if there is a gap of as many days in between (say for any reason), still on Day Close of the last worksheet the consecutive dates should appear, till the current date.

3. It should show an error message if the day close function is operated beyond the next working day.

In my present code you'll find other operations such as copying certain Ranges from the current worksheet to the next worksheet, ie copying range N2:N300 to range H2:H300 of the new worksheet, deleting ranges "B25:B3000,D25:D3000,E25:E3000" in the new worksheet and saving the workbook. this has to remain unchanged.

Please any one can help me sort this problem I'll be grateful.

My Present code...


Please Login or Register  to view this content.