Hi all,
Im not sure how this code works completely i found it using google, there is 3 different parts to it. 1st part is a Private Function as is the 2nd Part, The last part is just a Sub..
The code all works fine and does exactly what it is ment to do Encrypt Alphnumeric and special characters. My Question is,
Is it at all possible in the code below to have the encryption run without showing 3 input box's?... i would like it to just take the number in a given cell and automatically encrypt it to an adjacent cell, without the user knowing.. see code below..
Thanks in advance for any help
Im not sure how this code works completely i found it using google, there is 3 different parts to it. 1st part is a Private Function as is the 2nd Part, The last part is just a Sub..
The code all works fine and does exactly what it is ment to do Encrypt Alphnumeric and special characters. My Question is,
Is it at all possible in the code below to have the encryption run without showing 3 input box's?... i would like it to just take the number in a given cell and automatically encrypt it to an adjacent cell, without the user knowing.. see code below..
Code:
Sub EncryptionRange()
Dim xRg As Range
Dim xPsd As String
Dim xTxt As String
Dim xEnc As Boolean
Dim xRet As Variant
Dim xCell As Range
On Error Resume Next
xTxt = ActiveWindow.RangeSelection.Address
Set xRg = Application.InputBox("O1:", "O3", xTxt, , , , , 8) ' Shows an inputbox
Set xRg = Application.Intersect(xRg, xRg.Worksheet.UsedRange)
If xRg Is Nothing Then Exit Sub
xPsd = InputBox("Enter Password:") ' Shows an input box
If xPsd = "" Then
MsgBox "Password cannot be empty"
Exit Sub
End If
xRet = Application.InputBox("Type 1 to encrypt cell(s);Type 2 to decrypt cell(s)", "Number", , , , , , 1)' Shows an input box
If TypeName(xRet) = "Boolean" Then Exit Sub
If xRet > 0 Then
xEnc = (xRet Mod 2 = 1)
For Each xCell In xRg
If xCell.Value <> "" Then
xCell.Value = Encryption(xPsd, xCell.Value, xEnc)
End If
Next
End If
End Sub
Thanks in advance for any help