Stuck Again VB6

Charlie

Board Regular
Joined
Mar 1, 2002
Messages
134
Hi,
This problem looks pretty simple but I am having a devil of a time getting it right.
What I am looking to do is using Inputbox input a character and then use an IF statement to produce the words in a picbox "The character you entered was a vowel" and if the character was not a,e,i,o,u then print "The Character you entered is not a vowel".
The main problem I am having is how to input the letters a,e,i,o,u in the code itself.
Option Explicit

Private Sub cmdStart_Click()
'Declare required storage
Dim Var1 As String

'Invite user to enter character
Var1 = InputBox("Please enter a character ", "Character")

If Var1 = Chr(int)a,e,i,o,u Then
picMessage.Print "The Character you entered is a vowel "
End If
End Sub
Thanks
Charlie
This message was edited by Charlie on 2002-10-17 15:44
This message was edited by Charlie on 2002-10-17 16:08
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Mudface

MrExcel MVP
Joined
Feb 18, 2002
Messages
3,339
On 2002-10-17 15:43, Charlie wrote:
Hi,
This problem looks pretty simple but I am having a devil of a time getting it right.
What I am looking to do is using Inputbox input a character and then use an IF statement to produce the words in a picbox "The character you entered was a vowel" and if the character was not a,e,i,o,u then print "The Character you entered is not a vowel".
The main problem I am having is how to input the letters a,e,i,o,u in the code itself.
Option Explicit

Private Sub cmdStart_Click()
'Declare required storage
Dim Var1 As String

'Invite user to enter character
Var1 = InputBox("Please enter a character ", "Character")

If Var1 = Chr(int)a,e,i,o,u Then
picMessage.Print "The Character you entered is a vowel "
End If
End Sub
Thanks
Charlie
This message was edited by Charlie on 2002-10-17 15:44

Try: -<pre>
'Declare required storage
Dim Var1 As String

'Invite user to enter character
Var1 = InputBox("Please enter a character ", "Character")

Select Case LCase(Var1)
Case "a", "e", "i", "o", "u"
picMessage.Print "The Character you entered is a vowel "
End Select</pre>
 

IML

MrExcel MVP
Joined
Feb 15, 2002
Messages
1,743
A formula option for no good reason:
=IF(OR(A1={"a","e","I","o","u","y"}),"You"&IF(A1="y"," may have","")&" entered a vowel","")
 

Charlie

Board Regular
Joined
Mar 1, 2002
Messages
134
Thanks, I havent really started learning the select case statement yet.
It looks easy now, but how would I get the message "The character entered is not a vowel"
would I use another select case entry with all the letters of the alphabet defined minus the vowels..etc
Thanks
Charlie
 

Mudface

MrExcel MVP
Joined
Feb 18, 2002
Messages
3,339
You could use Case Else, eg: -

Select Case LCase(Var1)
Case "a", "e", "i", "o", "u"
picMessage.Print "The Character you entered is a vowel "
Case Else
picMessage.Print "The Character you entered is not a vowel "
End Select
 

Forum statistics

Threads
1,144,122
Messages
5,722,613
Members
422,447
Latest member
knopp

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top