0

I'm new to VBA so I'm sorry if I'm missing something simple. I am trying to make something to simplify my work and generate a set of dispatches. It's very simple but its also very tedious so I decided to make a script for this. The issue is, I get an "object required" on the 'Sub generate_Dispatch()' even though I'm only calling generate_Dispatch once, on the button. I have a feeling that the issue has to do with the worksheetFunction statement as this worked up until that point. I tried google and I looked several application.worksheetfunction.countif examples, but could not find a reason as to why im getting an error at the very top. I tried adding a "test" variable (so Sub generate_Dispatch(test) ) but got another error.

Can someone please explain to me the error in this?

TYIA

 Sub generate_Dispatch()
'Down Rooms List
'Get list of down rooms to work on
Workbooks.Open ("https://mySite.sharepoint.com/Downrooms.xls")
Set DRLWorkbook = ActiveWorkbook
Set DRLWorkSheet = ActiveSheet
Set RoomsCollumn = "A"
Set HKHRS = "H"
Set MTHRS = "I"

'MsgBox DRLWorkSheet.Range("A4").Value

'Schedule
'See who is working today
Workbooks.Open ("https://mySite.sharepoint.com/schedules.xls")
Set DSSWorkook = ActiveWorkbook

Dim dtToday As Date
dtToday = Date

If Application.WorksheetFunction.CountIf(ActiveSheet.Range("C3:I3", dtToday)) = 0 Then
MsgBox "Todays Date Found"
Else
MsgBox "todays date not found"
MsgBox dtToday

End If


End Sub

0 Answers0