Solved Why repeat the last Excel sheet row twice

zezo2021

Member
Local time
Today, 19:31
Joined
Mar 25, 2021
Messages
390
Why repeat the last Excel sheet row twice

the code is good
but repeat the last row
how to prevent from pasting the last row twice




Code:
For i = 0 To listSearch.ListCount
        If listSearch.Selected(i) = True Then
            ActiveWorkbook.Sheets("Database").Activate
            Rows(listSearch.List(i, 0)).Copy
            ActiveWorkbook.Sheets("Report").Activate
            LastRow = Worksheets("Report").Range("C" & Rows.Count).End(xlUp).Row + 1
            ActiveWorkbook.Sheets("Report").Rows(LastRow).PasteSpecial xlPasteValues
            ActiveWorkbook.Sheets("Start").Activate
      
        End If
Next i
 
thanks
Solved
Add -1 to the last of for
For i = 0 To listSearch.ListCount -1
 

Users who are viewing this thread

Back
Top Bottom