0

How can I check whether the first and last letter of a string are same or not? And if yes, a message should be shown using MsgBox.

Thanks in advance,
Lida

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by vb5prgrmr
0

None Case Sensitive

Option Explicit
Option Compare Text

Private Sub Form_Load()
Dim S As String
S = "This is a test"
If Left(S, 1) = Right(S, 1) Then MsgBox Left(S, 1) & " matches"
End Sub

For case sensitive remove the option compare text....

Good Luck

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.