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,

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.