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
  • 相关阅读:
    函数的返回值与调用
    函数的定义
    文件的高级应用
    文件三种打开模式
    c++0x11新特性:delete删除函数
    网络研发工程师
    cannot find -lGL
    webSocket 使用 HttpSession 的数据配置与写法
    websocket 使用 spring 的service层 ,进而调用里面的 dao层 来操作数据库 ,包括redis、mysql等通用
    redis 重启服务丢失 密码设置 现象 与 解决过程
  • 原文地址:https://www.cnblogs.com/shiningrise/p/8621212.html
Copyright © 2011-2022 走看看