PDA

View Full Version : [SOLVED:] byref argument type mismatch



werafa
03-01-2020, 04:35 PM
hi all,

I've got a byRef Argument type mismatch coming up during compile, but this is triggered when I try to pass a long to a long.
can anyone see anything that is stupidly obvious?

the code fails at 'myString = BuildCheckString(myRow)' - and myRow is dimmed as a long in both the calling and receiving code


Public Sub CheckForDupes()

Dim mySheet As Worksheet
Dim myTable As ListObject

Dim myString As String
Dim myRow As Long
Dim lastRow As Long

Set mySheet = ThisWorkbook.Worksheets("Data")
Set myTable = mySheet.ListObjects("tbl_DataEntry")

lastRow = myTable.ListRows.Count

'remove loop and trigger from worksheet events
For myRow = 1 To lastRow
myString = BuildCheckString(myRow) 'fails here
myTable.DataBodyRange.Cells(myRow, myTable.ListColumns("Check Duplicate String")).Value = myString
Next myRow



End Sub

Private Function BuildCheckString(ByRef myTable As ListObject, ByVal myRow As Long) As String
'build duplicate checker string

thanks in advance

werafa
03-01-2020, 04:38 PM
woops -
how stupid :(

there was another variable to be passed :banghead: