Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Error Handling to mitigate "Run Time Erorr 13 Type Mismatch" | Excel Programming | |||
"ByRef argument type mismatch" Error | Excel Programming | |||
Run-time Error "13" - File Type Mismatch | Excel Programming | |||
"FIND" generates "Type mismatch" error | Excel Programming | |||
Copying data to another worksheet gives "Type Mismatch" error | Excel Programming |