'删除空行 Sub DeleteEmptyRows() Dim LastRow As Long, r As Long LastRow = ActiveSheet.UsedRange.Rows.Count LastRow = LastRow + ActiveSheet.UsedRange.Row - Then Rows(r).Delete Next r End Sub '删除空列 Sub DeleteEmptyColumns() Dim LastColumn As Long, c As Long…
怎么让word自动删除第3.6.9.12等3的倍数页‘ Sub kk1206190933() Dim wNum As Integer Dim wPag As Integer With Selection wPag = .Information(wdNumberOfPagesInDocument) For wNum = Int(wPag / 3) * 3 To 3 Step -3 .GoTo wdGoToPage, , wNum .Bookmarks("\Page").Range.Del…
Sub 删除最后一行() If MsgBox("要为所有表格添加列吗?", vbYesNo + vbQuestion) = vbYes Then To ActiveDocument.Tables.Count ActiveDocument.Tables(i).Rows.Last.Delete Next MsgBox ("完成") Else MsgBox ("任务取消") End If End Sub…
Option Explicit '清空数据 Private Sub CommandButton1_Click() Dim qknum As Integer '选择是或者否 来确认删除数据 '中对话框类型 16+4 :16指图标类型是停止图标,4指出现的按钮是“是”“否”按钮 If (MsgBox("确定删除所有数据吗?", vbCritical + 16 + 4, "温馨提示") = vbNo) Then Exit Sub End If ' 要清…
Sub DeleteEmptyRows() Dim LastRow As Long, r As Long LastRow = ActiveSheet.UsedRange.Rows.Count LastRow Step Then Rows(r).Delete Next r End Sub '删除空列 Sub DeleteEmptyColumns() Dim LastColumn As Long, c As Long LastColumn = ActiveSheet.UsedRange.Column…
sub 删除多余工作表() Dim i As Integer Application.DisplayAlerts = False For i = Worksheets.Count To 1 step -1 If i >7 Then ThisWorkbook.Worksheets(i).Delete End If Next Application.DisplayAlerts = True End Sub…
通过查找关键字,然后删除整段文字的实现! Sub 删除查找含关键词的行() Dim KeyWord As String KeyWord = InputBox("请输入关键词(词长不限,中英均可):", "关键词设置", "") If KeyWord = "" Then Exit Sub Selection.HomeKey wdStory Do With Selection.Find .Text = KeyWord .Wrap…