Why am I getting a "Type mismatch" Error
If you don't declare the data type of a variable then it is assigned a
datatype of Variant. So in Sub Columns3(Cols()) your argument is a
Variant array but you are passing it an Integer array. So you can fix it
by using:
Sub Columns3(Cols() as Integer)
Hope this helps
Rowan
Mac Lingo wrote:
I have the following code in my VBA Program
Public Col_Ptrs(3) As Integer
and later in the program in a Macro is a call to "Columns3"
Call Columns3(Col_Ptrs).
The Function "Columns3" is specified as follows:
Sub Columns3(Cols())
And I get an Compile Error messages as follows:
Type Mismatch: Array or User Defined Type expected.
I have mocked it up in a little subroutine and it works there. But it
doesn't here. Why?
Thanks,
Mac Lingo
Berkeley, CA
|