Welcome to the Excel Forum

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed.

Seo Services company Manchester

Please Register to Remove these Ads

Please Register to Remove these Ads



Reply
  #1  
Old 07-05-2005, 03:49 PM
oS_Narley oS_Narley is offline
Registered User
 
Join Date: 05 Jul 2005
Posts: 2
oS_Narley is becoming part of the community
Help (cesar code)

Please Register to Remove these Ads

Hello

I am having a little problem, i know what i want to do with excel but i dont no where to start, i dont no what formula to use, what i am after is a spreadsheet to encrypt and decrpt 'cesar code'.

cesar code - e.g IBM becomes HAL, it take the letter before the letter and replaces it, i hope you undertsand that, like H is 1 letter before I and A is before B etc.

how could i do this with Excel?

Thanks very much

oS_Narley
Reply With Quote
  #2  
Old 07-05-2005, 05:05 PM
Jef Gorbach
Guest
 
Posts: n/a
Re: Help (cesar code)

You're looping a Find/ReplaceAll 26x so record a new macro while Replacing
all occurances of "I" with "H" in a sample word then stop recording and edit
the results for the balance of changes.
Macros can NOT be undone so run it on a *copy* of your source message.

ie, in excel:
Sub Macro1()
With Cells
.Replace what:="A", Replacement:="Z", Lookat:=xlPart
.Replace what:="B", Replacement:="A", Lookat:=xlPart
.Replace what:="C", Replacement:="B", Lookat:=xlPart
End With
End Sub

"oS_Narley" <oS_Narley.1rpq6v_1120594032.5605@excelforum-nospam.com> wrote
in message news:oS_Narley.1rpq6v_1120594032.5605@excelforum-nospam.com...
>
> Hello
>
> I am having a little problem, i know what i want to do with excel but i
> dont no where to start, i dont no what formula to use, what i am after
> is a spreadsheet to encrypt and decrpt 'cesar code'.
>
> cesar code - e.g IBM becomes HAL, it take the letter before the letter
> and replaces it, i hope you undertsand that, like H is 1 letter before
> I and A is before B etc.
>
> how could i do this with Excel?
>
> Thanks very much
>
> oS_Narley
>
>
> --
> oS_Narley
> ------------------------------------------------------------------------
> oS_Narley's Profile:

http://www.excelforum.com/member.php...o&userid=24928
> View this thread: http://www.excelforum.com/showthread...hreadid=384649
>



Reply With Quote
  #3  
Old 07-05-2005, 05:05 PM
Toppers
Guest
 
Posts: n/a
RE: Help (cesar code)

Hi,

Pass each character in your string to this function - will always return
upper case

Function cesar(strA)
strA = UCase(strA)
If strA = "A" Then cesar = "Z" Else cesar = Chr(Asc(strA) - 1)
End Function


Sub test()
MsgBox cesar("Z")
End Sub

HTH

"oS_Narley" wrote:

>
> Hello
>
> I am having a little problem, i know what i want to do with excel but i
> dont no where to start, i dont no what formula to use, what i am after
> is a spreadsheet to encrypt and decrpt 'cesar code'.
>
> cesar code - e.g IBM becomes HAL, it take the letter before the letter
> and replaces it, i hope you undertsand that, like H is 1 letter before
> I and A is before B etc.
>
> how could i do this with Excel?
>
> Thanks very much
>
> oS_Narley
>
>
> --
> oS_Narley
> ------------------------------------------------------------------------
> oS_Narley's Profile: http://www.excelforum.com/member.php...o&userid=24928
> View this thread: http://www.excelforum.com/showthread...hreadid=384649
>
>

Reply With Quote
  #4  
Old 07-05-2005, 05:05 PM
Bob Phillips
Guest
 
Posts: n/a
Re: Help (cesar code)

Here are a couple of functions that will encrypt and encrypt a whole word
that you can use

Function Encrypt(text As String)
Dim i As Long
Dim sTemp As String

For i = 1 To Len(text)
sTemp = sTemp & Chr(Asc(Mid(text, i, 1)) - 1)
Next i

Encrypt = sTemp
End Function


Function Decrypt(text As String)
Dim i As Long
Dim sTemp As String

For i = 1 To Len(text)
sTemp = sTemp & Chr(Asc(Mid(text, i, 1)) + 1)
Next i

Decrypt = sTemp
End Function



--

HTH

RP
(remove nothere from the email address if mailing direct)


"oS_Narley" <oS_Narley.1rpq6v_1120594032.5605@excelforum-nospam.com> wrote
in message news:oS_Narley.1rpq6v_1120594032.5605@excelforum-nospam.com...
>
> Hello
>
> I am having a little problem, i know what i want to do with excel but i
> dont no where to start, i dont no what formula to use, what i am after
> is a spreadsheet to encrypt and decrpt 'cesar code'.
>
> cesar code - e.g IBM becomes HAL, it take the letter before the letter
> and replaces it, i hope you undertsand that, like H is 1 letter before
> I and A is before B etc.
>
> how could i do this with Excel?
>
> Thanks very much
>
> oS_Narley
>
>
> --
> oS_Narley
> ------------------------------------------------------------------------
> oS_Narley's Profile:

http://www.excelforum.com/member.php...o&userid=24928
> View this thread: http://www.excelforum.com/showthread...hreadid=384649
>



Reply With Quote
  #5  
Old 07-05-2005, 07:20 PM
oS_Narley oS_Narley is offline
Registered User
 
Join Date: 05 Jul 2005
Posts: 2
oS_Narley is becoming part of the community
I cant seem to get that to wrok, please could you make it so i could view it?

Thank you much appreciated

oS_Narley
Reply With Quote


Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump