|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
'只对本表有效!
- Sub kao()
- On Error Resume Next
- Dim tt$, s$, ss$, tt$
- Dim js As Object
- Dim y As Object
- Dim i%
- Set js = CreateObject("ScriptControl")
- js.Language = "JScript"
- s = "var a={b:'0' };"
- js.addcode s
- arr = Range("B:H")
- For i = 3 To UBound(arr)
- tt = arr(i, 1)
- If Len(tt) > 0 Then
- If Len(js.eval("a['" & tt & "']")) = 0 Then
- s = "a['" & tt & "']=" & i & ";"
- js.addcode s
- Else
- ss = js.eval("a['" & tt & "']") & IIf(ss = "", "", "," & ss)
- s = "a['" & tt & "']=" & i & ";"
- js.addcode s
- End If
- End If
- Next
- Application.ScreenUpdating = False
- y = Split(ss, ",")
- For Each k In y
- Rows(k).Delete
- Next
- Application.ScreenUpdating = True
- MsgBox "job is okey!"
- End Sub
复制代码
|
|