Tring to make the following code work. For some reason returns a Run-time error '1004': Application-defined or object-defined error.
The code is the following:
Sub UpdateLinks()
Dim lastFlight, lastMis, logBook, studentCode As String
Dim i, j, k, numRows As Integer
Dim wb0 As Workbook
Dim studentSheet As Worksheet
Set wb0 = ActiveWorkbook
Set studentSheet = wb0.Worksheets("STUDENTS")
numRows = studentSheet.Range("A5").CurrentRegion.Rows.Count
studentCode = studentSheet.Cells(8, 2).Value
lastFlight = "=MAIOR('\\server\# FLTLOG_EXPORT\[" & studentCode & ".xlsx]Status'!$A$3:$A$219;1)"
lastMis = "=PROC(2;1/(1-É.CÉL.VAZIA('\\server\# FLTLOG_EXPORT\[" & studentCode & ".xlsx]Status'!$C$3:$C$230));'\\server\# FLTLOG_EXPORT\[" & studentCode & ".xlsx]Status'!$C$3:$C$230)"
logBook = "'\\server\# FLTLOG_EXPORT\[" & studentCode & ".xlsx]Desvios'!$Q$15"
ActiveSheet.Cells(8, 4).Formula = lastFlight
End Sub
The formulas are in Portuguese and MAIOR is LARGE, PROC is LOOKUP. The code stops in the:
ActiveSheet.Cells(8, 4).Formula = lastFlight
Please help. Kind regards.