| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 509 人关注过本帖
标题:工时问题VB做的。求高手看看
取消只看楼主 加入收藏
w7582366
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2011-5-20
收藏
 问题点数:0 回复次数:0 
工时问题VB做的。求高手看看
Sub aaa()
    Dim arr, brr(), d As Object, sht As Worksheet
    Dim m As Long, n As Long, i As Long, j As Integer, lr As Long, lc As Integer
    Set d = CreateObject("scripting.dictionary")
    d("序号") = 1: d("姓名") = 2
    m = 2
    For Each sht In Sheets
        With sht
            If .Name <> "汇总表" Then
                arr = .UsedRange
                For i = 3 To UBound(arr, 2)
                    temp = arr(2, i)
                    If temp <> "" And temp <> "日工时合计" Then
                        If d(temp) = "" Then
                            m = m + 1
                            d(temp) = m
                        End If
                    End If
                Next
            End If
        End With
    Next
    For Each sht In Sheets
        With sht
            If .Name <> "汇总表" Then
                arr = .UsedRange
                lr = UBound(arr)
                lc = UBound(arr, 2)
                If lr > 2 Then '有数值
                    For i = 3 To lr
                    n = n + 1
                    ReDim Preserve brr(1 To m, 1 To n)
                    brr(2, n) = .Name
                    brr(1, n) = arr(i, 1)
                        For j = 1 To lc
                            If d(arr(2, j)) <> "" Then brr(d(arr(2, j)), n) = arr(i, j)
                        Next j
                    Next i
                End If
            End If
        End With
    Next
    ActiveSheet.UsedRange.Clear
    Range("a1") = "月工时汇总表"
    Range("a2").Resize(1, m) = d.keys
    Range("a3").Resize(UBound(brr, 2), m) = Application.Transpose(brr)
End Sub
我这个程序做的有问题吗?为什么不好用呢,求高手进来看看谢谢
搜索更多相关主题的帖子: Object 汇总表 姓名 
2011-05-20 13:36
快速回复:工时问题VB做的。求高手看看
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.024330 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved