ThrottleWorks
Excel Ninja
I have a macro, code is pasted below.
The macro is taking a string from the input box & then printing each letter in the msgbox.
My problem is I do not want to print numbers.
For example if the user has inputted “Sachin83abc”
I want to print s a c h I n a b c
Can anyone help me in this please
Sub Test()
Dim strName As String
Dim MyLen As Integer
strName = InputBox(Prompt:="Please enter your name", _
Title:="ENTER YOUR NAME", Default:="Your Name here")
Worksheets("Set 2").Range("d16").Value = strName
If Len(Worksheets("Set 2").Range("d16").Value) < 5 Then
MsgBox "Invalid word !"
Exit Sub
Else
Dim strArray() As String
Dim strText As String
Dim lLoop As Long, lCount As Long
strText = Worksheets("Set 2").Range("d16").Value
lCount = Len(strText)
ReDim strArray(lCount - 1)
For lLoop = 0 To lCount - 1
strArray(lLoop) = Mid(strText, lLoop + 1, 1)
MsgBox strArray(lLoop)
Next lLoop
End If
End Sub
The macro is taking a string from the input box & then printing each letter in the msgbox.
My problem is I do not want to print numbers.
For example if the user has inputted “Sachin83abc”
I want to print s a c h I n a b c
Can anyone help me in this please
Sub Test()
Dim strName As String
Dim MyLen As Integer
strName = InputBox(Prompt:="Please enter your name", _
Title:="ENTER YOUR NAME", Default:="Your Name here")
Worksheets("Set 2").Range("d16").Value = strName
If Len(Worksheets("Set 2").Range("d16").Value) < 5 Then
MsgBox "Invalid word !"
Exit Sub
Else
Dim strArray() As String
Dim strText As String
Dim lLoop As Long, lCount As Long
strText = Worksheets("Set 2").Range("d16").Value
lCount = Len(strText)
ReDim strArray(lCount - 1)
For lLoop = 0 To lCount - 1
strArray(lLoop) = Mid(strText, lLoop + 1, 1)
MsgBox strArray(lLoop)
Next lLoop
End If
End Sub