![]() |
Why am I getting a "Type mismatch" Error
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 |
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 |
All times are GMT +1. The time now is 09:50 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com