key = 7 Print "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" 'Encrypt the text Print CaesarCypher$("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", key) 'Decrypt the text by changing the key to (26 - key) Print CaesarCypher$(CaesarCypher$("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", key), (26 - key)) Function CaesarCypher$(string$, key) If (key < 0) Or (key > 25) Then _ CaesarCypher$ = "Key is Ouside of Bounds" : Exit Function For i = 1 To Len(string$) rotate = Asc(Mid$(string$, i, 1)) rotate = (rotate + key) If Asc(Mid$(string$, i, 1)) > Asc("Z") Then If rotate > Asc("z") Then rotate = (Asc("a") + (rotate - Asc("z")) - 1) Else If rotate > Asc("Z") Then rotate = (Asc("A") + (rotate - Asc("Z")) - 1) End If CaesarCypher$ = (CaesarCypher$ + Chr$(rotate)) Next i End Function