|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 1121228509 于 2023-1-14 20:06 编辑
Option Explicit
Sub 电话号码加密()
Dim fk As Long, xh As Long, xhh As Long
Dim Arr As Variant, Brr As Variant
fk = Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row - 1
Arr = Sheets("Sheet1").Range("A2").Resize(fk, 1)
Brr = Array("g", "a", "l", "o", "r", "h", "I", "y", "k", "v")
ReDim Crr(1 To fk, 1 To 1) As Variant
For xh = 1 To fk
For xhh = 1 To Len(Arr(xh, 1))
If xhh > 3 And xhh < 8 And IsNumeric(Mid(Arr(xh, 1), xhh, 1)) = True Then
Crr(xh, 1) = Crr(xh, 1) & Brr(Mid(Arr(xh, 1), xhh, 1))
Else
Crr(xh, 1) = Crr(xh, 1) & Mid(Arr(xh, 1), xhh, 1)
End If
Next xhh
Next xh
Sheets("Sheet1").Range("A2").Resize(fk, 1) = Crr
End Sub
Sub 密电话号码解密()
Dim fk As Long, xh As Long, xhh As Long
Dim Arr As Variant, Brr As Variant
fk = Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row - 1
Arr = Sheets("Sheet1").Range("A2").Resize(fk, 1)
Brr = Array("g", "a", "l", "o", "r", "h", "I", "y", "k", "v")
ReDim Crr(1 To fk, 1 To 1) As Variant
For xh = 1 To fk
For xhh = 1 To Len(Arr(xh, 1))
If IsNumeric(Mid(Arr(xh, 1), xhh, 1)) = True Then
Crr(xh, 1) = Crr(xh, 1) & Mid(Arr(xh, 1), xhh, 1)
Else
Crr(xh, 1) = Crr(xh, 1) & Application.Match(Mid(Arr(xh, 1), xhh, 1), Brr, 0) - 1
End If
Next xhh
Next xh
Sheets("Sheet1").Range("A2").Resize(fk, 1) = Crr
End Sub
电话号码加密与解密.rar
(20.2 KB, 下载次数: 2)
|
|