vba交集代码怎么在EXCEL中运用vba交集代码怎么在表格EXECL中运用?下面这个是VBA交集代码不知道是否正确,Functionf(x,y)DimdicAsObjectSetdic=CreateObject("Scripting.Dictionary")x=Replace(x,"£¬",",")y=
vba交集代码怎么在表格EXECL中运用?下面这个是VBA交集代码不知道是否正确,
Function f(x,y)
Dim dic As Object
Set dic = CreateObject("Scripting.Dictionary")
x = Replace(x,"£¬",",")
y = Replace(y,"£¬",",")
a = Split(x,",")
b = Split(y,",")
For i = 0 To UBound(a) - 1
dic(a(i)) = ""
Next i
For i = 0 To UBound(b) - 1
If dic.exists(b(i)) Then f = f & b(i) & ","
Next i
Set dic = Nothing
End Function
A1=01,02,05,07,09
A2=02,05,08,13
A3=04,05,12,16,19
A4=03,05,18,19
A5=01,05,11,17,20
A6=1.2.5.6.9.10.22
A7=5.13.16.19.26.24
A8=3.5.10.11.15.17
求这8组数据的交集,
Public Function getJiaoJi(rng As Range) As String
On Error GoTo L_end
Dim d1 As Dictionary, d2 As Dictionary
Set d1 = New Dictionary: Set d2 = New Dictionary
Dim cel As Range
Dim tempstr() As String,temp as string
Dim star As Boolean
Dim i As Integer
Dim ky As Variant
For Each cel In rng
temp = cel.value
if instr(1,temp ,".")>0 then temp = temp.replace(temp ,".",",")
tempstr = Split(temp , ",")
For i = 0 To UBound(tempstr)
If star Then
If d2.Exists(tempstr(i)) Then
If Not d1.Exists(tempstr(i)) Then Call d1.Add(tempstr(i), tempstr(i))
Else
End If
Else
If Not d1.Exists(tempstr(i)) Then Call d1.Add(tempstr(i), tempstr(i))
If Not d2.Exists(tempstr(i)) Then Call d2.Add(tempstr(i), tempstr(i))
End If
Next
star = True
d2.RemoveAll
For Each ky In d1.Keys
Call d2.Add(ky, ky)
Next
d1.RemoveAll
Next
Dim str1 As String
For Each ky In d2.Keys
If str1 = "" Then
str1 = ky
Else
str1 = str1 & "," & ky
End If
Next
getJiaoJi = str1
Exit Function
L_end:
getJiaoJi = "err:" & Err.Description
End Function
微分方程2y"+y'-y=2e^x中λ怎么求. 2020-04-26 …
2分之x+x+2x+2分之x+2分之3x+x=39怎么解已知直线a图[2]如果在直线a上有A,B, 2020-06-06 …
“第X届X中全会”是什么意思?X届和X中怎样解释 2020-07-16 …
微分中A为什么为其导数!就是那个AΔx+o(x)中的A,书上说A为一个不依赖Δx的常数,那为什么一 2020-07-31 …
f(x)=x+a/x中,在a<0时,在(-∞,0),(0,+∞)上,它是增函数吗?那f(x)=x+ 2020-08-01 …
为什么指数函数y=a^x中的a为什么不能小于0?且不能等于1? 2020-08-02 …
1.设集合A={y|y=x²-2x+1,x∈R},集合B={y|y=-x²+1,x∈R},则A∩B 2020-08-02 …
三角函数图像的振幅可不可以为负数?y=Asin(ωx+φ)中的A?如果有题目说y=-2sinx=2 2020-08-02 …
急需.!辅助角公式中怎样求周期,在辅助角公式“asinx+bcosx=√a方+b方sin(x+φ)” 2020-12-19 …
已知a、b是正数,且a/x+b/y=1,x,y∈(0,+∞)求证:x+y≥(√a+√b)分别用代数法 2021-02-04 …