• VBA


    Sub 宏1()
    '
    ' 宏1 宏
    '
    
    '
        Range("E3:E33").Select
        Selection.Copy
        
        tyear = 2010
        tmonth = 1
        
        For startIndex = 3 To 2701 Step 31 '2436
            
            Range("E" & startIndex).Select
            ActiveSheet.Paste
        
            For i = 0 To 30
                Range("D" & (startIndex + i)).Select
                d = "" & tyear
                If tmonth < 10 Then
                    d = d & "0"
                End If
                d = d & tmonth
                
                ActiveCell.FormulaR1C1 = d
            Next
            tmonth = tmonth + 1
            If tmonth = 13 Then
                tyear = tyear + 1
                tmonth = 1
            End If
        Next
    End Sub
    Sub 宏2()
    '
    ' 宏1 宏
    '
    
    '
        col = 5
        For startIndex = 3 To 2701 Step 31 '2536
            Sheets("Sheet1").Select
            Range(Cells(2, col), Cells(32, col)).Select ' e2:e30
            Application.CutCopyMode = False
            Selection.Copy
            Sheets("批发_20180322").Select
          '  Sheets("Sheet2").Select
            Range(Cells(startIndex, 7), Cells(startIndex, 7)).Select ' g3:g3
            ActiveSheet.Paste
            col = col + 1
        Next
    End Sub
    
    Sub 宏111()
    '
    ' 宏1 宏
    '
    
    '
        Range("E3:E33").Select
        Selection.Copy
        tyear = 2010
        For startIndex = 2700 To 2917 Step 31 '2729
            Range("E" & startIndex).Select
            ActiveSheet.Paste
            For i = 0 To 30
                Range("D" & (startIndex + i)).Select
                d = "" & tyear & "99"
                ActiveCell.FormulaR1C1 = d
            Next
            tyear = tyear + 1
        Next
    End Sub
    Sub 宏2()
    '
    ' 宏2 宏
    '
    
    '
        For startIndex = 2 To 258 Step 1 '
            rowStart = (startIndex - 2) * 35 + 2
            
            Sheets("源表").Select
            Range("C1:AK1").Select
            Selection.Copy
            Sheets("目标表").Select
            
            Range("D" & rowStart).Select
            Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
                False, Transpose:=True
                
            Sheets("源表").Select
            Range("C" & rowStart & ":AK" & rowStart).Select
            Application.CutCopyMode = False
            Selection.Copy
            Sheets("目标表").Select
            Range("F" & rowStart).Select
            Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
                False, Transpose:=True
                
            Sheets("源表").Select
            ActiveWindow.ScrollColumn = 1
            Range("A" & startIndex).Select
            Application.CutCopyMode = False
            Selection.Copy
            Sheets("目标表").Select
            Range("C" & rowStart).Select
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
                :=False, Transpose:=False
            Application.CutCopyMode = False
            
            Range("C" & rowStart).Select
            Selection.Copy
            For i = 1 To 34
                tmpRowIndex = rowStart + i
                Range("C" & tmpRowIndex).Select
                ActiveSheet.Paste
            Next
        Next
        'ActiveWorkbook.Save
    
        
    End Sub
    Sub 宏2()
    '
    ' 宏2 宏
    '
    
    '
        For startIndex = 2 To 50 Step 1 '258
            rowStart = (startIndex - 2) * 35 + 2
            
            Sheets("源表").Select
            Range("C" & startIndex & ":AK" & startIndex).Select
            Application.CutCopyMode = False
            Selection.Copy
            Sheets("目标表").Select
            Range("F" & rowStart).Select
            Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
                False, Transpose:=True
                
                
            Sheets("源表").Select
            Range("C1:AK1").Select
            Selection.Copy
            Sheets("目标表").Select
            Range("D" & rowStart).Select
            Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
                False, Transpose:=True
                
                
            Sheets("源表").Select
            ActiveWindow.ScrollColumn = 1
            Range("A" & startIndex).Select
            Application.CutCopyMode = False
            Selection.Copy
            Sheets("目标表").Select
            Range("C" & rowStart).Select
            Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
                :=False, Transpose:=False
            Application.CutCopyMode = False
            Range("C" & rowStart).Select
            Selection.Copy
            For i = 1 To 34
                tmpRowIndex = rowStart + i
                Range("C" & tmpRowIndex).Select
                ActiveSheet.Paste
            Next
        Next
        'ActiveWorkbook.Save
        
    End Sub
  • 相关阅读:
    解决:TypeError: object() takes no parameters
    刷题(三)
    刷题(二)
    web自动化流程总结
    不能在Python Console中运行pytest
    关于pytest的一些问题
    UML设计,可以设计程序的用例图、类图、活动图等_SurfaceView
    android系统下消息推送机制
    Android中的动画,选择器,样式和主题的使用
    内存监测工具 DDMS --> Heap
  • 原文地址:https://www.cnblogs.com/shiningrise/p/8621212.html
Copyright © 2020-2023  润新知