Foxtable(狐表)用户栏目专家坐堂 → 代码


  共有4454人关注过本帖平板打印复制链接

主题:代码

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


加好友 发短信
等级:六尾狐 帖子:1470 积分:8981 威望:0 精华:0 注册:2013/10/24 9:12:00
  发帖心情 Post By:2015/4/27 16:49:00 [只看该作者]

    Dim App As New MSExcel.Application
    Dim wb As MSExcel.WorkBook = App.WorkBooks.open(f1)
    For Each Ws As MSExcel.WorkSheet In Wb.WorkSheets    '
        If ws.name = "分户快报" Then
            For n1 As Integer = 3 To 5
                For n2 As Integer = 4 To 48
                    If ws.cells(n2+1,n1+1).Formula = "" Then
                        ws.cells(n2+1,n1+1).Value = val(Sheet1(n2,n1).Value)
                    End If
                Next
            Next
        End If
        If ws.name = "资产负债表" Then
            ws.cells(4,1).Value = Sheet2(3,0).Value   '单位名称
            ws.cells(2,1).Value = Sheet2(1,0).Value   '日期
            For n1 As Integer = 2 To 3
                For n2 As Integer = 5 To 54
                    If ws.cells(n2+1,n1+1).Formula = "" Then
                        ws.cells(n2+1,n1+1).Value = val(Sheet2(n2,n1).Value)
                    End If
                    If ws.cells(n2+1,n1+5).Formula = "" Then
                        ws.cells(n2+1,n1+5).Value = val(Sheet2(n2,n1+4).Value)
                    End If
                Next
            Next
        End If
        If ws.name = "利润及分配表" Then
            For n1 As Integer = 2 To 3
                For n2 As Integer = 6 To 35
                    If ws.cells(n2+1,n1+1).Formula = "" Then
                        ws.cells(n2+1,n1+1).Value = val(Sheet3(n2,n1).Value)
                    End If
                    If ws.cells(n2+1,n1+5).Formula = "" Then
                        ws.cells(n2+1,n1+5).Value = val(Sheet3(n2,n1+4).Value)
                    End If
                Next
            Next
        End If
        If ws.name = "费用表" Then
            For n1 As Integer = 3 To 6
                For n2 As Integer = 4 To 32
                    If ws.cells(n2+1,n1+1).Formula = "" Then
                        ws.cells(n2+1,n1+1).Value = val(Sheet4(n2,n1).Value)
                    End If
                Next
            Next
        End If
        If ws.name = "工资月报" Then
            For n1 As Integer = 3 To 4
                For n2 As Integer = 4 To 24
                    If ws.cells(n2+1,n1+1).Formula = "" Then
                        ws.cells(n2+1,n1+1).Value = val(Sheet5(n2,n1).Value)
                    End If
                Next
            Next
        End If
        If ws.name = "附列资料" Then
            For n1 As Integer = 1 To 13
                For n2 As Integer = 2 To 19
                    If ws.cells(n2+1,n1+1).Formula = "" Then
                        ws.cells(n2+1,n1+1).Value = val(Sheet6(n2,n1).Value)
                    End If
                Next
            Next
        End If
    Next
代码中 If ws.name = "分户快报" Then,如何先判断“分户快报” 是否存在?

 回到顶部
总数 36 1 2 3 4 下一页