0Go1DKabum
New Member
- Joined
- Sep 30, 2021
- Messages
- 6
- Office Version
- 2016
- Platform
- Windows
Hi, guys.
I have built a spreadsheet to control rotation of crews but for some reason it is behaving oddly depending on the computer it is opened.
Whenever I open it in a computer with laguange set in Portuguese the flights are not returning the pax list unless I have to change the date format to PT BR (DD-MMM-YYYY), if I open in English language computer then it pops the same problem again and I have to change the dates manually too on the spreadsheet. Since I own a company computer and a personal computer I run into this mess all the time.
I would like to know if there is a way to have VBA to read the LOCALE and respect it without breaking erros. Even if it is a check on the WorkbookOpen event to read and trigger some variables for English or Portuguese.
The piece of code that is not working is this "IF" that needs to compare the user input to the range on the spreadsheet. The application.match always returns a error #N/A hence it does not do anything.
I appreciate any help!
The link to a sanitized copy is here: Sanitized Copy
I have built a spreadsheet to control rotation of crews but for some reason it is behaving oddly depending on the computer it is opened.
Whenever I open it in a computer with laguange set in Portuguese the flights are not returning the pax list unless I have to change the date format to PT BR (DD-MMM-YYYY), if I open in English language computer then it pops the same problem again and I have to change the dates manually too on the spreadsheet. Since I own a company computer and a personal computer I run into this mess all the time.
I would like to know if there is a way to have VBA to read the LOCALE and respect it without breaking erros. Even if it is a check on the WorkbookOpen event to read and trigger some variables for English or Portuguese.
The piece of code that is not working is this "IF" that needs to compare the user input to the range on the spreadsheet. The application.match always returns a error #N/A hence it does not do anything.
VBA Code:
Dim x, y(), z(), yy, zz, PON(), POFF(), i As Long, ii As Integer, iCol As Long
Dim iY As Integer, iZ As Integer, iON As Integer, iOFF As Integer, sDT As String
sDT = Format(Me.txtFlightDate, "dd-mmm-yyyy")
'sDT = CStr(Me.txtFlightDate)
shtParameters.Range("FlightDate").Value = sDT
If Not IsError(Application.Match(sDT, [Dates_Operations], 0)) Then
iCol = Application.Match(sDT, [Dates_Operations], 0)
x = [tblOperation]
For i = 1 To UBound(x, 1)
If x(i, iCol) = "E" Then
iY = iY + 1: ReDim Preserve y(1 To 11, 1 To iY)
y(1, iY) = iY ' Number
y(2, iY) = x(i, 1) ' Team / Company
y(3, iY) = x(i, 2) ' Position
y(4, iY) = x(i, 3) ' Name
y(5, iY) = x(i, 4) ' SISPAT
y(6, iY) = x(i, 5) ' Country
y(7, iY) = x(i, 7) ' Quarentine
y(8, iY) = x(i, 8) ' PCR
y(9, iY) = x(i, 9) ' Trans SBCB
y(10, iY) = x(i, 10) ' POO
...
I appreciate any help!
The link to a sanitized copy is here: Sanitized Copy