Hello all,
I'm having an issue with a set of coding that contains an array. For whatever reason i'm getting the following error. Compile error: ByRef argument type mismatch. The error seems to be with the following line:
Call STNOCMultiple(rw, Ary(I)). Can someone please let me know what i'm doing wrong so i can fix it. Thank you.
I'm having an issue with a set of coding that contains an array. For whatever reason i'm getting the following error. Compile error: ByRef argument type mismatch. The error seems to be with the following line:
Call STNOCMultiple(rw, Ary(I)). Can someone please let me know what i'm doing wrong so i can fix it. Thank you.
Code:
Sub NOCDrafting(rw As Long)
Dim NOCws As Worksheet
Set NOCws = ThisWorkbook.Worksheets("NOC")
If NOCws.Cells(rw, "B") <> "Complete" Then
Select Case NOCws.Cells(rw, "A").Value
Case "PUB"
If WorksheetFunction.CountA(NOCws.Cells(rw, "L").Resize(, 13)) = 13 Then
If MsgBox("NOC Requirements have been meet. Would you like the NOC to be drafted?", vbQuestion + vbYesNo, "NOC Completed") = vbYes Then
Select Case NOCws.Cells(rw, "E").Value
Case "IMP AGR"
Select Case NOCws.Cells(rw, "I").Value
Case Empty, ""
Call NOCSTD(rw)
Case Else
Call NOCSTD(rw)
Dim Ary As Variant: Ary = Split(NOCws.Cells(rw, "I"), ",")
For I = 0 To UBound(Ary)
Call STNOCMultiple(rw, Ary(I))
Next I
End Select
NOCws.Cells(rw, "B").Value = "Complete"
MsgBox ("NOC has been Drafted, Please Review.")
'Call DraftingDate(rw)
Case "MAINT AGR"
Call MaintNOC(rw)
NOCws.Cells(rw, "B").Value = "Complete"
'Call DraftingDate(rw)
Case "PW AGR"
Call PWNOC(rw)
NOCws.Cells(rw, "B").Value = "Complete"
'Call DraftingDate(rw)
Case "ST PERMIT"
Call STNOC(rw)
NOCws.Cells(rw, "B").Value = "Complete"
'Call DraftingDate(rw)
Case Else
Call PWNOC(rw)
NOCws.Cells(rw, "B").Value = "Complete"
'Call DraftingDate(rw)
End Select
Else
NOCws.Cells(rw, "B").Value = "Pending"
End If
End If
Case "PVT"
If WorksheetFunction.CountA(NOCws.Cells(rw, "L").Resize(, 16)) = 16 Then
If MsgBox("NOC Requirements have been meet. Would you like the NOC to be drafted?", vbQuestion + vbYesNo, "NOC Completed") = vbYes Then
Call NOCPrivateDoc(rw)
NOCws.Cells(rw, "B").Value = "Complete"
'Call DraftingDate(rw)
Else
NOCws.Cells(rw, "B").Value = "Pending"
End If
End If
End Select
End If
End Sub