In vba, a runtime error always occurs:
Sub rsa() Dim c1 As Long Dim c2 As Long Dim z As Long Dim e As Long pt = "xa" n = 187 e = 7 For i = 1 To Len(pt) b = Mid$(pt, i, 1) If b <> " " Then z = Asc(UCase(b)) 'Here is the problem: c = z ^ e Mod n Text = Text & c Else Text = Text & " " End If Next i Cells(20, 4).Value = Text End Sub
I get a runtime error in c = z ^ e Mod n .
I tried different data types, but without a solution.
vba excel-vba excel
yab86
source share