VBA常用操作

常用操作

删除掉演示数据

    ' 自动删除第四行
    Rows(4).Select
    Selection.EntireRow.Delete

已撤销、拒绝

For L = Sheets(1).Range("a65536").End(xlUp).Row To 1 Step -1
  If Range("C" & L) = "已撤销" Then
   Range("C" & L).Select
   Selection.EntireRow.Delete
   End If

    If Range("D" & L) = "拒绝" Then
   Range("D" & L).Select
   Selection.EntireRow.Delete
  End If
Next

标黄工号异常的

 q = Sheets(1).Range("a65536").End(xlUp).Row
 For i = 4 To q
    k = Len(Range("a" & i).Value)
    If k > 10 Then
    Rows(i).Select
        With Selection.Interior
            .PatternColorIndex = xlAutomatic
            .Color = 65535
            .TintAndShade = 0
            .PatternTintAndShade = 0
        End With
    End If
Next
Sub 请假_第二步()
Excel.Application.DisplayAlerts = False
    q = Sheets(1).Range("a65536").End(xlUp).Row
    For i = 4 To q
    k = Len(Range("D" & i).Value)
    If k = 10 Then
            Range("d" & i).Select
            Selection.EntireRow.Delete
    End If
Next
Excel.Application.DisplayAlerts = True

MsgBox "已经为您把标黄的行全部删除了,请继续执行第三步"
End Sub

去掉已离职

    Columns("C:C").Select
    Selection.Replace What:="(已离职)", Replacement:="", LookAt:=xlPart, _
     SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
    ReplaceFormat:=False

窗口提示

MsgBox ""

静默

Application.ScreenUpdating = False
Excel.Application.DisplayAlerts = False


Application.ScreenUpdating = True
Excel.Application.DisplayAlerts = True
posted @ 2021-03-31 23:25  张贺贺呀  阅读(372)  评论(0编辑  收藏  举报