Excel/return blank cells as 0's
Expert: Miguel Zapico - 8/18/2008
QuestionHello all,
I'de like to get zeroes instead of blank spaces in a table of roughly 6,000 codes. The issue is that I run a query weekly that pastes values into 12 columns (for the months of the year) of this table. I would like to get zeroes for the months that do not have any data since that way I could get a pivot tabel to automatically pick up this data.
Thanks
AnswerYou could do this manually in a couple of steps, by selecting the whole area, going to menu Edit->Goto->Special->Blanks, typing a 0 and entering it with Crtl+Enter.
You could use a macro like this, that does the same thing.
Sub FillBlanks()
Range("A1").CurrentRegion.SpecialCells(xlCellTypeBlanks).FormulaR1C1 = "0"
End Sub
You may need to change the first part if your range doesn't start on A1, or if the current region doesn't cover the full range that you want to fill.
Hope this helps,
Miguel
About Excel
This topic answers questions related to Microsoft Excel spreadsheet (or workbook) stand-alone or Mircrosoft Office Excel including Excel 2003, Excel 2007, Office 2000, and Office XP. You can get Excel help on Excel formulas(or functions), Excell macros, charting in Excel, advanced features, and the general use of Excel. This does not provide a general Excel tutorial nor the basics of using a spreadsheet. It provides specific answers to using Microsoft Excel only. If you do not see your
Excel question answered in this area then please ask an Excel question here