View Full Version : Automatically fill blank cells with specific text.

12-17-2008, 08:26 AM
I am creating an Excel template for a report I run monthly. I would like to write code that will automatically fill all blanks with a specific value. In researching the code I have run into two problems:

The report will always have the same number of columns but will have a different number of rows each month based on how many shipments were made. I could not find code that allows for this so that I don't leave any rows out but also don't fill every cell in the worksheet.
I cannot find code that will input the text, ?null" into blank cells. Everything I can find to reference puts the value of the cell above into the blank cell.Please help

Bob Phillips
12-17-2008, 08:31 AM
Are you saying that you want to autofill say from row 1 down? Where does blanks come into it for null, you said you wanted to fill blanks.

12-17-2008, 08:37 AM
The report consists of rows of data for items like: "Shippers Name", "Shippers Address", and so on. When an employee makes a shipment they do not always fill in all the fields so when I recieve the report at the end of the month some of the cells in the "Shippers Name" or "Department Name" will be blank. In order for me to outline the report I need all of the cells to contain data. I would like to run a macro when the worksheet is opened ot auto fill any blank cells with, "null". Because we ship a different amount of packages each month the number of rows will change each month and each example of auto fill I found had a range in it.

Bob Phillips
12-17-2008, 08:49 AM
This should do it

ActiveSheet.UsedRange.SpecialCells(xlCellTypeBlanks).Value = "Null"