View Single Post
 
Old 12-20-2024, 03:00 AM
p45cal's Avatar
p45cal p45cal is offline Windows 10 Office 2021
Expert
 
Join Date: Apr 2014
Posts: 947
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

Probably because the cells which appear blank are not in fact balnk. Check for a space or anything else in those cells.
If you have a formula in those blank cells which may result in the cell containing an empty string (eg. =IF(A1>10,10,"") ) then commas will show up.
Instead of checking for Empty, check the length of the cell contents. If at the same time you also want to exclude cells which have only a space or spaces in, then change the line:
Code:
If ignore_empty And IsEmpty(cell.Value) Then
to:
Code:
If ignore_empty And Len(Application.Trim(cell.Value)) = 0 Then
Reply With Quote