Question: So my job is to write a code in Excel with VBA to decrypt letters up by 5. Example a to f, b to g,

So my job is to write a code in Excel with VBA to decrypt letters up by 5. Example a to f, b to g, z to e etc.

My issue is that It worked just fine when I put a single letter like "a", but when I put "ab" or "a b", it didn't give me the results that I wanted which were "fg" and "f g" respectively. It gave me like "ab" and "a b" instead.

Please help me correct my code thank you

Ps. don't worry about the capital letters because I only deal with small letters

So my job is to write a code in Excel with VBA

Option Explicit Sub Fancy () Dim ascii As Long Dim x As String Dim v As String x = InputBox ("place your code here") If x Like "[a-z]" Then ascii = Asc (x) + 5 If asc11 122 Then ascii = ascii - 26 v = chr (ascii) Else v=x End If MsgBox v End Sub

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!