Thread: Number Format
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Number Format

Hi
try something like
IF CLng(cells(r,c).value)=variable then

--
Regards
Frank Kabel
Frankfurt, Germany


Lionel Fridjhon wrote:
I have variable that is declared as Long. When I use the
variable in an If statement such as
"If cells(r,c)=variable then"
I get the cell as a number but the variable insists on
appearing in quotes, indicating a string. As a result
the If statement comes out false.

Example If 2501 = "2501" then is false
How can I ensure that the variable is represented as a
number in the if statement so that thje answer is True?

Lionel