Here’s how you can fix your code. Of course it’s not the best way to do date calculations, and you’ll also have to validate that there is text in the 2 text boxes, and maybe even use CDate()
to parse the text to date values, but this will work for your current situation.
If DateDiff("d", txtOrderDate.Text, txtRecievedDate.Text) < 0 Then MsgBox "Incorrect Date, item can't be recieved before order" else MsgBox "correct date" End If
Related Posts:
- What does <> mean?
- How to find a value in an excel column by vba code Cells.Find
- Check if a string contains another string
- VBScript to open a dialog to select a filepath
- Does VBA have Dictionary Structure?
- “Sub or Function not defined” when trying to run a VBA script in Outlook
- What is the function of FormulaR1C1?
- What exactly is the function of Application.CutCopyMode property in Excel
- VBA Excel – Insert row below with same format including borders and frames
- Deleting a file in VBA
- Excel VBA: Can’t get a match, error “Unable to get the Match property of the WorksheetFunction class”
- How to comment and uncomment blocks of code in the Office VBA Editor
- Run-time error ‘3061’. Too few parameters. Expected 1. (Access 2007)
- Pass arguments to Constructor in VBA
- How to install Date Picker form control in Excel 2016
- How to install Date Picker form control in Excel 2016
- How to fill color in a cell in VBA?
- Refreshing all the pivot tables in my excel workbook with a macro
- VBA: Run time error ’91’?
- What is the difference between “Form Controls” and “ActiveX Control” in Excel 2010?
- ‘Cannot find DAO350.dll’ file error VB6
- Average in VBA in Excel
- VBA Excel “Compile error: Object Required”
- Choosing paper size (NOT DEFAULT sizes) in excel vba
- “Unable to get the VLookup property of the WorksheetFunction Class” error [duplicate]
- Paste Special error 1004 PasteSpecial method of Range class failed
- VBA: Getting run-time 1004: Method ‘Range’ of object ‘_Worksheet’ failed when using cells
- Cannot run the macro… the macro may not be available in this workbook
- How to use Regular Expressions (Regex) in Microsoft Excel both in-cell and loops
- How to use Regular Expressions (Regex) in Microsoft Excel both in-cell and loops
- Object Required Error in excel VBA
- What are .NumberFormat Options In Excel VBA?
- Better way to find last used row
- VBA, if a string contains a certain letter
- Excel VBA Macro: User Defined Type Not Defined
- lists and arrays in VBA
- VBA Runtime Error 1004 “Application-defined or Object-defined error” when Selecting Range
- Select method of Range class failed via VBA
- Does VBA contain a comment block syntax?
- Why does “Paste Method of Worksheet class failed” occasionally occur?
- How to return a result from a VBA function
- How to clear memory to prevent “out of memory error” in excel vba?
- Use VBA to Clear Immediate Window?
- VBA: Else without If Error
- Recommended IDE for VBA
- ByRef argument type mismatch in Excel VBA
- VBA: Convert Text to Number
- VBA Error: “Compile error: Expected End Sub”
- Scraping data from website using vba
- Error: “Could Not Find Installable ISAM”
- Loop without Do error
- Row count where data exists
- VBA array sort function?
- Test or check if sheet exists
- How to detect if user select cancel InputBox VBA Excel
- macro run-time error ‘9’: subscript out of range
- How to Clear Office Clipboard with VBA
- Why does my VBA code throw an “Invalid outside procedure” error?
- Excel Solver Password: what is it and where can it be acquired/bought?
- Using Excel VBA to run SQL query
- Compile error: Next without For || VBA
- Is there a way to crack the password on an Excel VBA Project?