Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help (cesar code)


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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 59
Default 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" wrote
in message ...

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default 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


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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" wrote
in message ...

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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help (cesar code)


I cant seem to get that to wrok, please could you make it so i could
view it?

Thank you much appreciated

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
split post code (zip code) out of cell that includes full address Concord Excel Discussion (Misc queries) 4 October 15th 09 06:59 PM
Code to conditional format all black after date specified in code? wx4usa Excel Discussion (Misc queries) 3 December 26th 08 07:06 PM
Drop Down/List w/Code and Definition, only code entered when selec Spiritdancer Excel Worksheet Functions 2 November 2nd 07 03:57 AM
Create a newworksheet with VBA code and put VBA code in the new worksheet module ceshelman Excel Programming 4 June 15th 05 04:37 PM
stubborn Excel crash when editing code with code, one solution Brian Murphy Excel Programming 0 February 20th 05 05:56 AM


All times are GMT +1. The time now is 08:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"