I have a Let property defined as:
Public Property Let Set_ChanArray_Enabled1(i As Integer, j As Integer, choice As Boolean)
ChanArray(i, j).Enabled1 = choice
End Property
In a sub defined in the same object module, I attempt to do the following:
For j = 4 To 44
Me.Set_ChanArray_Enabled1(j, 1) = True
Me.Set_ChanArray_Enabled1(j, 3) = True
Next j
But VBE gives me a ByRef argument mismatch pointing to the j passed into
Me.Set_ChanArray_Enabled1(j, 1) = True
I have defined both j and the parameter passed into the method as integers so I am not sure what is wrong.
That error indicates something is wrong with the typing of
j(i.e its not of type integer).Have you declared it in a statement like;
dim j, i as integer? If so then onlyiis an integer (you need to repeatas integer).(Using
byvalappears to “fix” this because its pass-by-copy semantics allow VBA to perform an automatic type conversion to integer before callingSet_ChanArray_Enabled1).