I have a large macro that begins by copying a range to a Temp sheet and removing the duplicates to begin processing the data.
If I run the macro with an assigned button (or F5) it errors out due to encountering blank cells in the Temp sheets after the remove duplicates operation. Looking in the Temp sheet after the code stops, I see that there are 10 blank lines (or cells - I can't tell due to only column A having data at this stage) inserted about 3/4 of the way down my list.
If I put a break point on the remove duplicates line, the code stops and shows me the list that was copied to the clipboard, which correctly contains no blanks at all, and the pasted list on the Temp sheet also contains no blanks at all. If I press F8 on the remove duplicates line, the list is condensed just as it should be, with no blanks.
To summarise: the following line ends up with blanks in the list if pressing F5, but correctly has no blanks if pressing F8
Attached is a screenshot of the input and outputs.
I have been using this macro for months and never encountered this problem, but now it occurs on both my Win10/Excel 2019 machine and my Win11/365 machine.
What is going wrong?
If I run the macro with an assigned button (or F5) it errors out due to encountering blank cells in the Temp sheets after the remove duplicates operation. Looking in the Temp sheet after the code stops, I see that there are 10 blank lines (or cells - I can't tell due to only column A having data at this stage) inserted about 3/4 of the way down my list.
If I put a break point on the remove duplicates line, the code stops and shows me the list that was copied to the clipboard, which correctly contains no blanks at all, and the pasted list on the Temp sheet also contains no blanks at all. If I press F8 on the remove duplicates line, the list is condensed just as it should be, with no blanks.
To summarise: the following line ends up with blanks in the list if pressing F5, but correctly has no blanks if pressing F8
VBA Code:
Xero.Sheets("Temp").Range("$A$1:A" & Cells(Rows.Count, "A").End(xlUp).Row).RemoveDuplicates Columns:=1, Header:=xlNo
Attached is a screenshot of the input and outputs.
I have been using this macro for months and never encountered this problem, but now it occurs on both my Win10/Excel 2019 machine and my Win11/365 machine.
What is going wrong?