zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    Matlab画图-非常具体,非常全面
    PostgreSQL代码分析,查询优化部分,pull_ands()和pull_ors()
    Windows内核
    [WebGL入门]十,矩阵计算和外部库
    HOG特征-理解篇
    hdu 5035 概率论
    Hibernate对象持久化框架
    Thinkpad X200 屏幕备案
    64地点 Windows 8/7 根据系统 32地点PLSQL 耦合 64 地点 Oracle 11g
    阐述php(四) 流量控制
  • 原文地址:https://www.cnblogs.com/shiningrise/p/8621212.html
Copyright © 2011-2022 走看看