View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default excel vb question

Then you can't initialise is as you thought. What you can do is something
like this

Public test As Variant

Sub myCode()

If IsEmpty(test) Then
test = 0
End If
'rest of code

End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Darryl" wrote in message
...
Sorry I wasn't very clear.
I need it to be a variable as I'm going to increment it as I do
certain things.


"Bob Phillips" wrote in message
...
Darryl,

You can use a constant

Public Const test As Integer = 0

of course, that stops you changing it later.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Darryl" wrote in message
...
Greetings,
I am writing some vb code in excel (version that comes with Office

2000).

I am a programmer, and really haven't dealt with excel before.

If I define a public variable on the workbook, can I initialize it at
definition ?

ie,
public test as integer init 0

How do I initialize the variable (or determine it needs

initialization)
before using it ?

thanks,
-D