View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default mismatch error and Variants

Your sub has multiple undeclared variables in it.
You should use "Option Explicit" as the first line of
every module. That forces you to declare all variables and
highlights misspelled variables for you.

I am guessing that your declaration of Wrow as an Integer may be flawed.
In your sub you use this line ... "Dim i, j, k, l As Integer" ...
which results in i, j, k, being declared as Variants and only
l being an integer.
If you did the same thing with Wrow, that is your problem.

In general, avoid the use of Integer as a data type.
The Long data type is preferred. Using an Integer for a row
number variable will cause an error above row ~32700.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"T_o_n_y"
wrote in message
Yes, WRow is dimensioned as an integer in the subroutine that has the GetP
call. I didn't want to include that entire subroutine as well because it's
also rather long. But it has lines:
Dimm WRow as Integer
Dim AnIBlk as Boolean

That is what is so puzzling to me about all this.

-Tony


"mudraker" wrote:


Tony


when you call GetP is the data that you are using to supply to Wrow a
Integer if it is not
you will get a mismath error

eg the following code errors because data in Macro1 is a Long number
and Wrow expecting a Integer number

sub Macro1
dim myLong as Long
myLong = 45
call Macro2(myLong)
end sub

sub Macro2(Wrow as Integer)

mycodehere
end sub


--
mudraker
------------------------------------------------------------------------
mudraker's Profile: http://www.excelforum.com/member.php...fo&userid=2473
View this thread: http://www.excelforum.com/showthread...hreadid=535794