![]() |
declare type and value on one line?
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 ? |
declare type and value on one line?
Multiple condiftion tests are allowed
Dim sexy As Boolean = True... did not work. -Neil -----Original 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 ? . |
declare type and value on one line?
As many as you like :-
If catsLoveDogs = True And dogsLoveCats = False Then ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
declare type and value on one line?
You can do the first, only as a constant:
Const Sexy As Boolean = True AND is the conjunction operator OR is the disjunction operator If (catsLoveDogs = True) AND (dogsLoveCats = False) Then -- Regards, Tom Ogilvy "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 ? |
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 ? |
All times are GMT +1. The time now is 05:13 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com