У меня есть код, который вырезает и вставляет строки во второй лист, где есть ячейка, содержащая «Да».
Как удалить оставшуюся пустую строку из исходного листа?
Option Explicit
Sub Copy_n_Paste()
On Error Resume Next
Dim srchtrm As String
Dim rng As Range, destRow As Long
Dim shtSrc As Worksheet, shtDest As Worksheet
Dim c As Range
Dim i As Integer
Dim Today As Date
With Application
.ScreenUpdating = False
.DisplayStatusBar = False
.Calculation = xlCalculationManual
.EnableEvents = False
End With
Set shtSrc = Sheets("DOCS")
Set shtDest = Sheets("ARCHIVE")
destRow = Worksheets("ARCHIVE").UsedRange.Rows.Count
Set rng = Application.Intersect(shtSrc.Range("R2:R1000"), shtSrc.UsedRange)
For Each c In rng.Cells
If c.Value = "Yes" Then
c.EntireRow.Cut shtDest.Cells(destRow, 1)
destRow = destRow + 1
End If
Next
With Application
.ScreenUpdating = True
.DisplayStatusBar = True
.Calculation = xlCalculationAutomatic
.EnableEvents = True
End With
Application.CutCopyMode = False
Sheets("DOCS").Range("A1").Select
End Sub