For some reason, the VB compiler doesn't seem to be recognizing the ListRow type in my Subroutine. I've been developing the subroutine piece by piece, and it has been working fine, then, I started getting Compile error: "ByRef argument type mismatch" for a function call that was fine before. When I look at the function definition, the ListRow parameter being passed ByRef has been changed to "listRow" (lowercase L). Upon further examination, ListRow has been changed in the entire module. I don't know what I did that caused it. ListObject and ListColumns are fine, only ListRow is affected. If I change it back to ListRow, when I move the cursor off the definition, it gets changed back to listRow. Very strange.
This is the subroutine code I currently have. The affected declaration is the fourth Dim statement
Here is the Function that the compiler complains about
Thanks in advance for any help!
This is the subroutine code I currently have. The affected declaration is the fourth Dim statement
Code:
Sub GenLatestVerRpt()
Dim wsSrc, wsRpt As Worksheet
Dim tblCDRLs, tblRpt As ListObject
Dim srcCols, rptCols As ListColumns
Dim srcRow, rptRow As listRow
Dim currDRD, thisDRD As String
Dim latestSub, latestAccpt As String: latestSub = "": latestAccpt = ""
Set wsSrc = Worksheets("CDRLS - Full List")
Set wsRpt = Worksheets("Latest Version Report")
Set tblSrc = wsSrc.ListObjects("tblCDRLs")
Set tblRpt = wsRpt.ListObjects("tblLatVerRpt")
Set srcCols = tblSrc.ListColumns
Set rptCols = tblRpt.ListColumns
'Clear Existing Report
If (tblRpt.ListRows.Count >= 1) Then
tblRpt.DataBodyRange.Delete
End If
currDRD = tblSrc.ListRows(2).Range(1, srcCols("CDRL / DRD").Range.Column)
If (isMulti(tblSrc.ListRows(2))) Then
currDRD = currDRD & tblSrc.ListRows(i).Range(1, srcCols("EDN").Range.Column)
End If
For i = 2 To tblSrc.ListRows.Count
srcRow = tblSrc.ListRows(i)
If (isMulti(srcRow)) Then
thisDRD = thisDRD & srcRow.Range(1, srcCols("EDN").Range.Column)
Else
thisDRD = srcRow.Range(1, 1)
End If
If (thisDRD = currDRD) Then
If (isSubmitted(srcRow)) Then
latestSub = getSubNum(srcRow)
End If
If (isDisp(srcRow)) Then
latestDisp = getDisp(srcRow)
End If
Else
'Found first entry of next DRD so insert current DRD row in report
Set rptRow = tblRpt.ListRows.Add(AlwaysInsert:=True)
rptRow.Range(1, rptCols("ID").Range.Column) = currDRD
rptRow.Range(1, rptCols("Title").Range.Column) = srcRow.Range(1, srcCols("Title").Range.Column)
rptRow.Range(1, rptCols("Latest Rev Submitted").Range.Column) = latestSub
rptRow.Range(1, rptCols("Latest Rev Approved").Range.Column) = latestDisp
currDRD = Left(thisDRD, 5) 'In case the EDN had been appended
End If
Next i
End Sub
Here is the Function that the compiler complains about
Code:
Function isMulti(ByRef rowToSrch As listRow)
If (rowToSrch.Range(1, 35) = "Yes") Then
isMulti = True
Else
isMulti = False
End If
End Function
Thanks in advance for any help!