Thread: cell values
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Sharad Sharad is offline
external usenet poster
 
Posts: 123
Default cell values


Entering a data into cell with preceeding " ' " casues it to be a text.
so '0599 will be treated as text 0599 and Len funtion will return 4.

In your macro when your refer to the cell value you can use Val.
e.g. : Instead of Len(Cells(1, 1).Value) use:
Len (Val(Cells(1, 1).Value)).
If you are assinging the cell value to a varible, declare the variable
as an intger
e.g. :
Dim myInt As Integer

myInt = Cells(1, 1).Value

Or if it is not delcared as integer again use Val function as under:

myInt = Val(Cells(1, 1).Value)

Sharad


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!