Check that date exists

S

sailor4life61

Hello
My code opens daily files on a (monthly basis) and pastes data into my
workbook. There should be at least one line of data for each day and
the date is in column A stating on row 3. I would like to have a
message via a popup box ("Data does not exist for mm/dd") if a day is
not represented in Column A. How can this be accomplished?

Also, I am using an input box as follows:

sMonth = InputBox("Please Enter Reporting Month")
sYear = InputBox("Please Enter Reporting Year")


With Sheets("Data")
.Range("B1").Value = sMonth
.Range("A1").Value = sYear
End With

This works, however I would like the month fomatted as MM and
currently is is formatted as M.

Thanks!
 
J

jodleren

Hello
My code opens daily files on a (monthly basis) and pastes data into my
workbook.  There should be at least one line of data for each day and
the date is in column A stating on row 3.  I would like to have a
message via a popup box ("Data does not exist for mm/dd") if a day is
not represented in Column A. How can this be accomplished?

DateSerial could help you,but it is not that hard to wite it yourself
(I'd do that)

if year>year(now) or
(days<30 and month in [3...]

It is possible to have it all in one IF - just remember
every 4 year is a leap year
every 100 year is not
every 400 is
Also, I am using an input box as follows:

sMonth = InputBox("Please Enter Reporting Month")
sYear = InputBox("Please Enter Reporting Year")

    With Sheets("Data")
   .Range("B1").Value = sMonth
   .Range("A1").Value = sYear
    End With

Why dont you create your own form? That would be easier and you can
add some control too?
Or use a calendar on that?

This works, however I would like the month fomatted as MM and
currently is is formatted as M.

check Cells.NumberFormat
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

formatting input boxes 3
InputBox Date Value 7
Excel Macro Prompting 2
Find a date in list less or equal than target date 4
Format issues... 3
inputbox uk date 4
adding 1 hour to input box 11
Filter Problem 2

Top