Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 947
Default boolean variable?

MyVar = False
Else: MyVar = True


Just an alternative to If..Then..Else

Dim MyVar As Boolean
Dim Answer As Long

Answer = MsgBox("Is this a font color?", vbYesNo + vbQuestion, "True or
False")

MyVar = (Answer = vbYes)

= = = = = =
Dana DeLouis



On 10/1/09 2:16 PM, Steve wrote:
Howdee all.
I have a macro that I've got a variable that presently requires either a
true, or false input.
This macro calls to another function, which only requires an input if the
element is true.
I'd like it to only require an input if the statement is true.

I just tried-

MyVar = Application.InputBox(Prompt:="Is this a font color?- True or False",
Type:=4)

If MyVar= "" Then
MyVar = False
Else: MyVar = True
End If

I receive a type mismatch error when I do this.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Set Boolean Variable for Changing Any Control on Userform Ryan H Excel Programming 3 July 10th 09 05:28 PM
Boolean Variable Definition James Excel Programming 1 August 14th 08 06:42 PM
More on Boolean Epinn New Users to Excel 7 November 28th 06 09:29 AM
VBA Boolean Jeff Excel Discussion (Misc queries) 1 February 2nd 06 10:01 PM
UserForm not passing Boolean variable Chip Pearson Excel Programming 2 July 19th 03 06:06 PM


All times are GMT +1. The time now is 09:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"