excel 会计报表学习-宏按钮 复制期初

2/23/2009来源:Excel教程人气:9060

按钮_复制期初 Macro
' xieheyq03 记录的宏
'

'
  Dim bkname As String
  bkname = ThisWorkbook.Name
     copymsg = MsgBox("确定要更新期初数据吗?注意更新后不能恢复!", vbOKCancel + vbExclamation, "警告")
    If copymsg = vbOK Then
   
    If (ActiveSheet.PRotectContents) Then
        ActiveSheet.Unprotect
    End If
    Sheets("损益表").Select
    application.Run "选项_显示"
    Range("C5:C24").Select
    Selection.Copy
    Range("D5").Select
    Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=False
    Application.Run "选项_隐藏累计"
    Range("C5").Select
    Sheets("费用明细").Select
    Application.Run "选项_显示费用"
    Range("C6:C44").Select
    Selection.Copy
    Range("K6").Select
    Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=False
    Application.Run "选项_隐藏费用"
    Range("C9").Select
    Sheets("试算平衡表").Select
   
    Range("B261:AU261").Select
    Selection.Copy
    ActiveWindow.LargeScroll ToRight:=-9
    ActiveWindow.SmallScroll Down:=6
    Range("B272").Select
    Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
        False, Transpose:=False
   
   
    ActiveWindow.SmallScroll Down:=-9
    Range("b4:bD258").Select
    Selection.ClearContents
    Range("B3").Select
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
   
    End If
End Sub

 

学习语句和期初复制,简单讲就是更新数据设置。目前正在逐句学习