Try something like: Sub AddSpace() Dim rCell As Range For Each rCell In Selection If rCell.Value = "" Then rCell = " " Next rCell End Sub
hth paul ________________________________ From: MikeS <[email protected]> To: MS EXCEL AND VBA MACROS <[email protected]> Sent: Thursday, June 11, 2009 8:50:03 AM Subject: $$Excel-Macros$$ Add blank space to a cell if it's empty How can this be done in VBA? Select some cells For each cell, if the cell.contents = "" ; is empty then set cell.contents = " " ; blank space that's it thanks! --~--~---------~--~----~------------~-------~--~----~ ------------------------------------------------------------------------------------- Some important links for excel users: 1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 2. Excel tutorials at http://www.excel-macros.blogspot.com 3. Learn VBA Macros at http://www.vbamacros.blogspot.com 4. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to [email protected] If you find any spam message in the group, please send an email to: Ayush Jain @ [email protected] or Ashish Jain @ [email protected] ------------------------------------------------------------------------------------- -~----------~----~----~----~------~----~------~--~---
