VBA check whether a row for the current date has been filled in and return yes/no value in another cell.

drefiek2

New Member
Joined
Apr 23, 2023
Messages
48
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
Hi,
I have 12 sheets, each with a table with dates on, each row is for one date during that month (i.e. January sheet has 31 rows and column A is the date column), and I would like some VBA code which will check that the row for the current date has been filled in (the user either types a 0 or 1 in the cells), in its entirety (there are 6 columns). And returns either the word 'yes' or 'no' to a cell on a different sheet.
I am not sure if the code needs to use the system date? Either way I am not sure what code to use to do this so any help is greatly appreciated.
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Does that include column A?

What is the name of the sheet and destination cell address?
Hi there, no it does not include column A as that column is already filled in as dates, so will be columns B:G
Sheet name is 'verification' and destination cell address is O4.
Sorry for lack of info in original post, was end of 12 hour night shift!!
 
Upvote 0
This macro assumes that the sheets are named using the full month names, for example: January, February, March, etc.
VBA Code:
Sub CheckCurrentDate()
    Application.ScreenUpdating = False
    Dim foundDate As Range
    Set foundDate = Sheets(MonthName(Month(Date))).Range("A:A").Find(Date, LookIn:=xlFormulas, lookat:=xlWhole)
    If WorksheetFunction.CountA(Range("B" & foundDate.Row).Resize(, 6)) = 6 Then
        Sheets("verification").Range("O4") = "yes"
    Else
        MsgBox ("The data for today's date is not complete in the " & MonthName(Month(Date)) & " sheet.")
    End If
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
Solution
This macro assumes that the sheets are named using the full month names, for example: January, February, March, etc.
VBA Code:
Sub CheckCurrentDate()
    Application.ScreenUpdating = False
    Dim foundDate As Range
    Set foundDate = Sheets(MonthName(Month(Date))).Range("A:A").Find(Date, LookIn:=xlFormulas, lookat:=xlWhole)
    If WorksheetFunction.CountA(Range("B" & foundDate.Row).Resize(, 6)) = 6 Then
        Sheets("verification").Range("O4") = "yes"
    Else
        MsgBox ("The data for today's date is not complete in the " & MonthName(Month(Date)) & " sheet.")
    End If
    Application.ScreenUpdating = True
End Sub
Thank you, it works!
 
Upvote 0
You are very welcome. :)
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,959
Members
449,096
Latest member
Anshu121

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top