我曾经用电子表格做了一个根据组别序号个数,自动分组,现在想用狐表实现自动分组。如组别相同序号个数小于16,不分组,大于等于16,小于30分两组,分别在组别名称后加1小组,2小组;大于等于31,小于等于45分3个小组,以此类推。不知狐表编写语言是否与vba一样,请老师指点一下。另如何学习狐表编程语言?谢谢!
(如图)
此主题相关图片如下:11.png
vba语言
Sub lqxs()
Dim arr, i&, aa, j&, n&, m&
Dim d, k, t
Set d = CreateObject("Scripting.Dictionary")
Sheet1.Activate
[I2:I2001].ClearContents
arr = [a1].CurrentRegion
For i = 1 To UBound(arr)
d(arr(i, 1)) = d(arr(i, 1)) & i & ","
Next
k = d.keys: t = d.items
For i = 0 To UBound(k)
t(i) = Left(t(i), Len(t(i)) - 1)
If InStr(t(i), ",") Then
aa = Split(t(i), ",")
n = UBound(aa) + 1
If n >= 16 And n <= 30 Then
For j = 0 To UBound(aa)
m = m + 1
If m > 2 Then
m = 1
End If
If m = 1 Then
zz = "1组"
ElseIf m = 2 Then: zz = "2组"
End If
Cells(aa(j), 10) = arr(aa(j), 6) & zz
Next
ElseIf n >= 31 And n <= 45 Then
For j = 0 To UBound(aa)
m = m + 1
If m > 3 Then
m = 1
End If
If m = 1 Then
zz = "1组"
ElseIf m = 2 Then: zz = "2组"
ElseIf m = 3 Then: zz = "3组"
End If
Cells(aa(j), 10) = arr(aa(j), 6) & zz
Next
ElseIf n >= 46 And n <= 60 Then
For j = 0 To UBound(aa)
m = m + 1
If m > 4 Then
m = 1
End If
If m = 1 Then
zz = "1组"
ElseIf m = 2 Then: zz = "2组"
ElseIf m = 3 Then: zz = "3组"
ElseIf m = 4 Then: zz = "4组"
End If
Cells(aa(j), 10) = arr(aa(j), 6) & zz
Next
。。。。。。