|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
原帖由 lin68 于 2010-3-18 19:40 发表
请再帮一下:
2. 各月份工作表的也要写一个宏,从H列和K列提取不重复值到B列,先清空B列商品名称再提取重复值。
谢谢!
Sub FIGJS()
Set x = CreateObject("SCRIPTCONTROL")
x.Language = "JSCRIPT"
For Each Sht In ThisWorkbook.Sheets
If Sht.Name <> "汇总" Then
Set arr = x.eval("new Array()")
Sht.[b6:b8888] = Empty
For i = 6 To 888
If InStr(arr & ",", Sht.Cells(i, "f") & ",") = 0 Then
arr.push Sht.Cells(i, "f").Value
End If
Next
For i = 6 To 888
If InStr(arr & ",", Sht.Cells(i, "k") & ",") = 0 Then
arr.push Sht.Cells(i, "k").Value
End If
Next
Sht.[b6].Resize(UBound(Split(arr, ",")) + 1, 1) = Application.Transpose(Split(arr, ","))
End If
Next |
|