EXCEL 使用宏 打水印

Sub 宏1()
'
' 宏1 宏   //用于调整列宽 加边框
'
' 快捷键: Ctrl+w
'
    ActiveCell.Cells.Select
    ActiveCell.Cells.EntireColumn.AutoFit
    ActiveCell.Columns("A:A").EntireColumn.Select
    Selection.ColumnWidth = 3.4
    ActiveCell.Offset(0, 1).Columns("A:A").EntireColumn.Select
    Selection.ColumnWidth = 12
    ActiveCell.Offset(0, 1).Columns("A:A").EntireColumn.Select
    Selection.ColumnWidth = 25
    ActiveCell.Offset(0, 1).Columns("A:A").EntireColumn.Select
    Selection.ColumnWidth = 6.78
    ActiveCell.Offset(0, 1).Columns("A:A").EntireColumn.Select
    Selection.ColumnWidth = 13
    ActiveCell.Offset(0, 1).Columns("A:A").EntireColumn.Select
    Selection.ColumnWidth = 20
    ActiveCell.Offset(0, -3).Columns("A:A").EntireColumn.Select
    With Selection
        .HorizontalAlignment = xlGeneral
        .VerticalAlignment = xlCenter
        .WrapText = True
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    ActiveCell.Offset(0, 3).Columns("A:A").EntireColumn.Select
    With Selection
        .HorizontalAlignment = xlGeneral
        .VerticalAlignment = xlCenter
        .WrapText = True
        .Orientation = 0
        .AddIndent = False
        .IndentLevel = 0
        .ShrinkToFit = False
        .ReadingOrder = xlContext
        .MergeCells = False
    End With
    ActiveCell.Offset(0, -5).Range("A1:F75").Select
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    Selection.Borders(xlInsideVertical).LineStyle = xlNone
    Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
    Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    With Selection.Borders(xlEdgeLeft)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeTop)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeBottom)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlEdgeRight)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlInsideVertical)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
    With Selection.Borders(xlInsideHorizontal)
        .LineStyle = xlContinuous
        .ColorIndex = 0
        .TintAndShade = 0
        .Weight = xlThin
    End With
End Sub


Sub 宏2()
'
' 宏2 宏
'
' 快捷键: Ctrl+Shift+O
'
    ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 67.8, 73.2, 321, _
        106.8).Select
    Selection.ShapeRange.IncrementRotation -28.98145
    Selection.ShapeRange.IncrementLeft -26.4
    Selection.ShapeRange.IncrementTop -2.1204724409
    Selection.ShapeRange(1).TextFrame2.TextRange.Characters.Text = "1"
    Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 1).ParagraphFormat. _
        FirstLineIndent = 0
    With Selection.ShapeRange(1).TextFrame2.TextRange.Characters(1, 1).Font
        .Bold = msoTrue
        .NameComplexScript = "+mn-cs"
        .NameFarEast = "+mn-ea"
        .Fill.Visible = msoTrue
        .Fill.ForeColor.ObjectThemeColor = msoThemeColorDark1
        .Fill.ForeColor.TintAndShade = 0
        .Fill.ForeColor.Brightness = 0
        .Fill.Transparency = 0
        .Fill.Solid
        .Size = 24
        .Name = "+mn-lt"
    End With
    Selection.ShapeRange.Fill.Visible = msoFalse
    Selection.ShapeRange.Line.Visible = msoFalse
    Application.CommandBars("Format Object").Visible = False
    With Selection.ShapeRange.TextFrame2.TextRange.Font.Fill
        .Visible = msoTrue
        .ForeColor.ObjectThemeColor = msoThemeColorDark1
        .ForeColor.TintAndShade = 0
        .ForeColor.Brightness = 0
        .Transparency = 0.8299999833
        .Solid
    End With
End Sub

Sub 宏3()
'
' 宏3 宏
'
' 快捷键: Ctrl+Shift+i
'
    Application.CutCopyMode = False
    Selection.Copy
    ActiveSheet.Paste
    Selection.ShapeRange.IncrementTop 160
    Selection.ShapeRange.IncrementLeft -50
    ActiveSheet.Paste
    Selection.ShapeRange.IncrementTop 160
    Selection.ShapeRange.IncrementLeft -50
    ActiveSheet.Paste
    Selection.ShapeRange.IncrementTop 160
    Selection.ShapeRange.IncrementLeft -50
End Sub

 

posted @ 2018-07-19 10:41  木制铁盒  阅读(443)  评论(0编辑  收藏  举报