View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Defining variables

Hi,

When you dim your variable by default it is set as nothing which for an
integer variable is the same as zero which can be demonstrated with this bit
of code

Dim cnt As Integer
MsgBox cnt + 10

If you try this you will find the message box displays 10 so cnt was zero

Mike

"Pawan" wrote:

Hi

I have few variables which have default value of 0. This value will change
during macro execution. Is there any way to declare 0 value to these
variables while defining those at the beginning of the code? Means when we
define variable as Dim cnt as integer, can I define 0 value there itself?

Thank You