VBA做的一段处理




Dim startId As Long


Private Sub CommandButton1_Click()

        startId = 11
        
       ' For i = 1 To 64 Step 1
       '     Sheet1.Cells(1, startId + i) = Sheet1.Cells(i, 2)
        '    Sheet1.Cells(2, startId + i) = Sheet1.Cells(i, 4)
       '     Sheet1.Cells(3, startId + i) = Sheet1.Cells(i, 6)
        '    Sheet1.Cells(4, startId + i) = Sheet1.Cells(i, 8)
       ' Next
       
        Dim usea As Long
        Dim moda As Long
        Dim linea As Long
        
        linea = 0
        For i = 1 To 1023 Step 1
        

        moda = i Mod 4
        If moda = 0 Then
           usea = 8
        End If
        If moda = 1 Then
           usea = 2
           linea = linea + 1
        End If
        If moda = 2 Then
           usea = 4
        End If
        If moda = 3 Then
           usea = 6
        End If
        
        
        Sheet1.Cells(i, 11) = Sheet1.Cells(linea, usea)
        Next
       ' Sheet1.Cells(1, 11) = Sheet1.Cells(1, 2)
        'Sheet1.Cells(2, 11) = Sheet1.Cells(1, 4)
       ' Sheet1.Cells(3, 11) = Sheet1.Cells(1, 6)
       ' Sheet1.Cells(4, 11) = Sheet1.Cells(1, 8)
        'Sheet1.Cells(5, 11) = Sheet1.Cells(2, 2)
        'Sheet1.Cells(6, 11) = Sheet1.Cells(2, 4)
       ' Sheet1.Cells(7, 11) = Sheet1.Cells(2, 6)
       ' Sheet1.Cells(8, 11) = Sheet1.Cells(2, 8)
       ' Sheet1.Cells(9, 11) = Sheet1.Cells(3, 2)
       ' Sheet1.Cells(10, 11) = Sheet1.Cells(3, 4)
        'Sheet1.Cells(11, 11) = Sheet1.Cells(3, 6)
       ' Sheet1.Cells(12, 11) = Sheet1.Cells(3, 8)
End Sub


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值