sgmpatnaik
Active Member
Hi all
Good Afternoon
i need some help to create a code for booking system that is i want to check the Check in Date and check out date, i have one code which is working for single criteria but when i try to use 2 criteria then i got a error Msg for Type MisMatch the code is
The error code is
your replay is highly appreciate
Thanking You
With Regards
SP
Good Afternoon
i need some help to create a code for booking system that is i want to check the Check in Date and check out date, i have one code which is working for single criteria but when i try to use 2 criteria then i got a error Msg for Type MisMatch the code is
Code:
Sub PostBooking()
Dim msg As String, Ans As Variant
Dim iRow As Long, iCol As Long
Dim inDate As Date, outDate As Date
msg = "This Selected Item is currently booked for the selected date."
msg = msg & vbLf & vbLf & "Please select a different Item"
msg = msg & vbLf & vbLf & vbLf & "This booking will not be posted"
With Sheet1.Range("C37")
inDate = .Range("C20").Value
outDate = .Range("G20").Value
Select Case .Value
Case Is = "Available" 'OK to place booking
With Sheet5 'Booking Status
Dim lCell As Range
Set lCell = Sheet5.Range("B65536").End(xlUp).Offset(1, 3)
lCell.Value = Sheet1.Range("C23").Value 'Guest Name
lCell.Offset(0, -3).Value = Sheet1.Range("C18").Value 'Enquiry Date
lCell.Offset(0, -2).Value = Sheet1.Range("C20").Value 'Check In Date
lCell.Offset(0, -1).Value = Sheet1.Range("G20").Value 'Check Out Date
lCell.Offset(0, 1).Value = Sheet1.Range("C25").Value 'Address
lCell.Offset(0, 2).Value = Sheet1.Range("C31").Value 'Hall Type
lCell.Offset(0, 3).Value = Sheet1.Range("G31").Value ' Hall Amount
End With
'show the room as booked on the Dates Tab
With Sheet3
iRow = Application.WorksheetFunction.Match(Sheet1.[inDate] & [outDate], Range("Dates"), 0)
iCol = Application.WorksheetFunction.Match(Sheet1.[C31], Range("Function_Halls"), 0)
iRow = iRow + 7 'adjust for header
iCol = iCol + 1 'adjust for header
.Cells(iRow, iCol).Value = "Booked"
End With
Case Else
Ans = MsgBox(msg, vbInformation)
End Select
'Call PostRoomBooking
End With
End Sub
The error code is
Code:
iRow = Application.WorksheetFunction.Match(Sheet1.[inDate] & [outDate], Range("Dates"), 0)
your replay is highly appreciate
Thanking You
With Regards
SP