办公软件技巧

一.excel

excel 使用vba

使用录制宏

Sub copy1()
    Dim q%, x%, y%
    For i = 0 To 52
    x = 2 + 181 * i
    y1 = 10 + 3 * i
    Range(Cells(x, 1), Cells(x, 2)).copy Range(Cells(1, y1), Cells(1, y1 + 1)) '用来选择区域'
    Range(Cells(1, 6), Cells(1, 8)).copy Range(Cells(2, y1), Cells(2, y1 + 2))
    Range(Cells(x, 6), Cells(x + 180, 8)).copy Range(Cells(3, y1), Cells(183, y1 + 2))
   Next
        
End Sub

统计个数

Sub 评定等级()
    Dim i As Integer

    Dim x100 As Integer
    x100 = 0
    Dim x200 As Integer
    x200 = 0
    Dim x300 As Integer
    x300 = 0
    Dim x400 As Integer
    x400 = 0
    Dim up400 As Integer
    up400 = 0
    Dim j As Integer
    Dim modx As Integer

    For j = 3 To 19
    modx = j Mod 2
    If (modx = 1) Then
    For i = 6 To 17
        t = Sheet1.Cells(i, j).Value
        If (t < 100) And (t <> "") Then
            x100 = x100 + 1
        ElseIf (t < 200) And (t <> "") Then
            x200 = x200 + 1
        ElseIf (t < 300) And (t <> "") Then
            x300 = x300 + 1
        ElseIf (t < 400) And (t <> "") Then
            x400 = x400 + 1
        ElseIf (t >= 400) And (t <> "") Then
            up400 = up400 + 1
        End If
     Next
     End If
   Next
   
   For j = 3 To 19
    modx = j Mod 2
    If (modx = 1) Then
    For i = 20 To 31
        t = Sheet1.Cells(i, j).Value
        If (t < 100) And (t <> "") Then
            x100 = x100 + 1
        ElseIf (t < 200) And (t <> "") Then
            x200 = x200 + 1
        ElseIf (t < 300) And (t <> "") Then
            x300 = x300 + 1
        ElseIf (t < 400) And (t <> "") Then
            x400 = x400 + 1
        ElseIf (t >= 400) And (t <> "") Then
            up400 = up400 + 1
        End If
     Next
     End If
   Next
     
     Sheet1.Cells(34, 2).Value = x100
     Sheet1.Cells(35, 2).Value = x200
     Sheet1.Cells(36, 2).Value = x300
     Sheet1.Cells(37, 2).Value = x400
     Sheet1.Cells(38, 2).Value = up400
     
     Sheet1.Cells(34, 3).Value = x100 / 182
     Sheet1.Cells(35, 3).Value = x200 / 182
     Sheet1.Cells(36, 3).Value = x300 / 182
     Sheet1.Cells(37, 3).Value = x400 / 182
     Sheet1.Cells(38, 3).Value = up400 / 182
     
End Sub

点击宏启用宏
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值