'vbscript 复制一块区域 Private Sub CommandButton1_Click() Range("E5:I5").Select Selection.Copy Dim str For i = 7 To 200 str = "E" & i & ":" & "I" & i Range(str).Select ActiveSheet.Paste Next Application.CutCopyMode = False End Sub '处理单元格格式 Private Sub CommandButton1_Click() '边框 Selection.Borders(xlEdgeLeft).LineStyle = xlContinuous Selection.Borders(xlEdgeTop).LineStyle = xlContinuous Selection.Borders(xlEdgeBottom).LineStyle = xlContinuous Selection.Borders(xlEdgeRight).LineStyle = xlContinuous Selection.Borders(xlInsideVertical).LineStyle = xlContinuous Selection.Borders(xlInsideHorizontal).LineStyle = xlContinuous '单元格格式 With Selection .HorizontalAlignment = xlLeft .VerticalAlignment = xlTop .WrapText = True .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With '颜色 With Selection.Interior .ColorIndex = 35 .Pattern = xlSolid End With '字体 With Selection.Font .Name = "Arial" .Size = 9 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With End Sub
处理excel单元格常用vba
最新推荐文章于 2022-09-26 10:22:18 发布