Solved Why repeat the last Excel sheet row twice (1 Viewer)

zezo2021

Member
Local time
Today, 22:52
Joined
Mar 25, 2021
Messages
381
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
 

zezo2021

Member
Local time
Today, 22:52
Joined
Mar 25, 2021
Messages
381
thanks
Solved
Add -1 to the last of for
For i = 0 To listSearch.ListCount -1
 

Users who are viewing this thread

Top Bottom