jongooligan
Board Regular
- Joined
- Jul 23, 2007
- Messages
- 90
Can anyone give me some tips to speed up this code? It applies a simple Ceasar Cipher to records in Excel - shifts text a number of places in the character set. So, if intDigitShift is 3 A would become D.
I'm using Excel 2003 on Windows XP SP2.
Application.ScreenUpdating = False
ActiveWorkbook.Worksheets("EncryptDecrypt").Activate
strFirst = Range("A1").Address
strLast = Range("A1").SpecialCells(xlCellTypeLastCell).Address
Set RgScramble = Range(strFirst, strLast)
For Each c In RgScramble
i = 1
strScrambled = "'"
strToScramble = c.Value
Do Until i = Len(strToScramble) + 1
lCode = Asc(Mid(strToScramble, i, 1)) + intDigitShift + i
strScrambled = strScrambled & Chr(lCode)
i = i + 1
Loop
c.Value = strScrambled
Next c
Range("A1").Select
Application.ScreenUpdating = True
MsgBox "Finished Encryption."
I'm using Excel 2003 on Windows XP SP2.
Application.ScreenUpdating = False
ActiveWorkbook.Worksheets("EncryptDecrypt").Activate
strFirst = Range("A1").Address
strLast = Range("A1").SpecialCells(xlCellTypeLastCell).Address
Set RgScramble = Range(strFirst, strLast)
For Each c In RgScramble
i = 1
strScrambled = "'"
strToScramble = c.Value
Do Until i = Len(strToScramble) + 1
lCode = Asc(Mid(strToScramble, i, 1)) + intDigitShift + i
strScrambled = strScrambled & Chr(lCode)
i = i + 1
Loop
c.Value = strScrambled
Next c
Range("A1").Select
Application.ScreenUpdating = True
MsgBox "Finished Encryption."