Sub Macro()
Dim txt As String
Dim result As String
Dim i As Integer
result = ""
txt = InputBox("")
For i = 1 To Len(txt)
result = result & change(Mid(txt, i, 1))
Next
MsgBox result
End Sub
Function change(ByVal char As String) As String
On Error GoTo errorhandler
Dim x As Byte
x = Asc(char)
If x > 64 And x < 91 Then
change = chr(x + 32)
ElseIf x > 96 And x < 123 Then
change = chr(x - 32)
Else
change = char
End If
Exit Function
errorhandler:
change = char
End Function
Sub Macro()
Dim txt As String
Dim result As String
Dim i As Integer
result = ""
txt = InputBox("")
For i = 1 To Len(txt)
result = result & change(Mid(txt, i, 1))
Next
MsgBox result
End Sub
Function change(ByVal char As String) As String
On Error GoTo errorhandler
Dim x As Byte
x = Asc(char)
If x > 64 And x < 91 Then
change = chr(x + 32)
ElseIf x > 96 And x < 123 Then
change = chr(x - 32)
Else
change = char
End If
Exit Function
errorhandler:
change = char
End Function