View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default Compare string with integer

You have to "coerce" the data in one type to that of the other. Look up
"coerce" in VBA Help for the various Cxxx function.

NickHK

"hurriance" wrote
in message ...

I am using excel 2002. I want to compare a string variable with an
integer variable. i.e.

dim i as integer
i=1
dim s as string
s="1"
if i = s then
..........
else
.....
end if

however, when I run this macro, a error occur.
how should I compare the variable with two different format ?


--
hurriance
------------------------------------------------------------------------
hurriance's Profile:

http://www.excelforum.com/member.php...o&userid=30882
View this thread: http://www.excelforum.com/showthread...hreadid=555450