How Can We Help?
< All Topics
How do I stop the Repeat Until command when reaching an empty cell in Excel?
UpdatedJune 27, 2022
The trick is that when copying an empty cell to the clipboard, the clipboard is not really empty because Excel adds hidden formatting characters.
A couple of extra steps are required for Macro Express to determine that a cell is empty. After copying the cell to the clipboard, save the contents to a text string variable. Modify the string by using the Trim command to trim the extraneous hidden characters that Excel adds. Then a true comparison can be made.
Repeat Until %T1% = “”
Clipboard Copy
Variable Set String %T1% from Clipboard
Variable Modify String: Trim %T1%
*** remainder of macro steps ***
Repeat End
– Applies to: Macro Express and Macro Express Pro