Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I'm trying to find a day in a given month. The code has given me this error: Code:BC30452 Operator '-' is not defined for types 'Date' and 'Integer'.

This is the code:
VB
Dim MonthNumber, datetime
MonthNumber = Format(Now, "MM")
datetime = DateSerial(2020, MonthNumber, 1) - (Weekday(DateSerial(2020, MonthNumber, 1), vbWednesday) + 14)


What I have tried:

Tried to use datetime.subtract but that didn't work for this code.
Posted
Updated 6-Jan-20 9:12am
Comments
MadMyche 6-Jan-20 14:42pm    
Is this VB6, VB.Net, or VBA?

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900