View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default declare type and value on one line?

Jamie,

You can't initialize a variable in its declaration. The closest you can get
is to use the ":" character to put two logical lines of code on one actual
line of text. E.g.,

Dim sexy As Boolean : sexy = True


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com

"Jamie Martin" wrote in message
...
Can I declare the type and the value of a variable on one line, such as

Dim sexy As Boolean = True

?

Also, can I do a two-condition test, like

If (catsLoveDogs = True) && (dogsLoveCats = False) Then
MsgBox("All is right with the world.")
End If

?