Foxtable(狐表)用户栏目专家坐堂 → 如何把vba语言转换成狐表编程语言


  共有2915人关注过本帖树形打印复制链接

主题:如何把vba语言转换成狐表编程语言

帅哥哟,离线,有人找我吗?
wu725
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:77 积分:996 威望:0 精华:0 注册:2012/2/6 16:33:00
如何把vba语言转换成狐表编程语言  发帖心情 Post By:2016/5/28 16:59:00 [显示全部帖子]

我曾经用电子表格做了一个根据组别序号个数,自动分组,现在想用狐表实现自动分组。如组别相同序号个数小于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

。。。。。。


 回到顶部
帅哥哟,离线,有人找我吗?
wu725
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:77 积分:996 威望:0 精华:0 注册:2012/2/6 16:33:00
  发帖心情 Post By:2016/5/29 11:35:00 [显示全部帖子]

谢谢楼主,上名语言执行市提示GetValues不是DataTables成员,无法运行,如果>=16,小于<30可以用我编写vba语言方式吗?

 回到顶部