Jumat, 05 Juli 2013

Re: [ExcelVBA] user input bax

 

Try this :-

        If Not cChar Like "[a-z, ,A-Z]" Then

Regards

Derek Turner
+++
 

>________________________________
> From: ashok kumar.s.v <ashokkumarsv@yahoo.com>
>To: "ExcelVBA@yahoogroups.com" <ExcelVBA@yahoogroups.com>
>Sent: Friday, 5 July 2013, 15:15
>Subject: Re: [ExcelVBA] user input bax
>
>
>

>if you mean to allow only a-z or A-Z then you need to compare character by character to get the result.
>
>this is one way of doing it.
>
>    Dim str As String
>    
>    str = InputBox("Enter your name: ", "Name")
>    
>    IsInValid = False
>    For i = 1 To Len(str)
>        cChar = Mid$(str, i, 1)
>        If (Asc(cChar) < Asc("a") Or Asc(cChar) > Asc("z")) And (Asc(cChar) < Asc("A") Or Asc(cChar) > Asc("Z")) Then
>            IsInValid = True
>            Exit For
>        End If
>    Next
>    
>    If IsInValid Then
>        MsgBox " Only Chracters "
>    Else
>        MsgBox " Your name is " & str
>    End If
>
>Regards,
>Ashok
>
>________________________________
>From: arindam <chocolate_eat@yahoo.co.in>
>To: ExcelVBA@yahoogroups.com
>Sent: Friday, July 5, 2013 6:19 PM
>Subject: [ExcelVBA] user input bax
>
>

>I m a VBA new bee.
>I was making a inputbox with validation of entering only characters.
>Dim str As String
>
>str = InputBox("Enter your name: ", "Name")
>
>If IsNumeric(str) Then
>MsgBox " Only Chracters "
>Else
>MsgBox " Your name is " & str
>End If
>
>Plz help.
>
>[Non-text portions of this message have been removed]
>
>
>
>
>

[Non-text portions of this message have been removed]

__._,_.___
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)
Recent Activity:
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------
.

__,_._,___

Tidak ada komentar:

Posting Komentar