Vba byref argument type mismatch

Posted on by

ByRef argument type mismatch

vba byref argument type mismatch

Excel VBA Introduction Part 43.1 - ByRef and ByVal

and    how much do uber drivers make per mile

Login or Sign Up. Member List Calendar Forum Rules. Byref argument type mismatch. This topic is closed. Posts Latest Activity. Search For. Page of 1.

A Developer. An Eweek. The variable index1 shown in red below gets highlighted when the error occurs. Any hint will be appreciated. To do is to be Descartes.


An argument passed ByRef by reference , the default, must have the precise data type expected in the procedure. This error has the following cause and solution:. For example, this error occurs if you try to pass an Integer variable when a Long is expected. If you want coercion to occur, even if it causes information to be lost, you can pass the argument in its own set of parentheses. For example, to pass the Variant argument MyVar to a procedure that expects an Integer argument, you can write the call as follows:. Placing the argument in its own set of parentheses forces evaluation of it as an expression. During this evaluation, the fractional portion of the number is rounded not truncated to make it conform to the expected argument type.

2 thoughts on “Vba byref argument type mismatch

Leave a Reply