Populate empty cells

U412178

New Member
Joined
Apr 12, 2011
Messages
41
I have a spreadsheet that contains blank cells in a row (the entire row is not blank, just random cells). Is there a marco or formula I can use to automatically fill-in the random empty cells upon opening the workbook? I would like the blank cells to show "CANCELLED".

Thank you for your help in advance!
 
Did you try the code that brettdj initially posted? I am curious if that works for you.
 
Upvote 0

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
If the cells are truly blank then you can use the SpecialCells shortcut (also available manually without code, via F5 - Goto Special - Blanks and then type in "CANCELLED" in the edit bar and hit Cntl & Enter together)

This code goes in the ThisWorkbook module

It runs on the used range portion of the first worksheet

hth

Dave

Code:
Private Sub Workbook_Open()
On Error Resume Next
ThisWorkbook.Sheets(1).UsedRange.SpecialCells(xlBlanks) = "CANCELLED"
End Sub

I just tried this code again too, and it puts "cancelled" in every single cell too. I guess I'm just too difficult. And I could do it manually but I highly prefer not too, I would like to automate as much as possible.
 
Upvote 0
I will check it out at home. Right now I am using version 2003. At home I have access to 2003, 2007, and 2010.
 
Upvote 0
Perhaps Excel has got itself confused with what it thinks is your used range. Does this variant which forces a used range re-think work?

Cheers

Dave

Code:
Private Sub Workbook_Open()
On Error Resume Next
Dim lngRow As Long
lngRow = ActiveWorksheet.UsedRange.Rows.Count
ThisWorkbook.Sheets(1).UsedRange.SpecialCells(xlBlanks) = "CANCELLED"
End Sub
 
Upvote 0
perhaps you should just try
Code:
Sub cancellations()
Dim u
u = ActiveSheet.UsedRange.Replace("", "Cancelled")
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,375
Messages
6,124,589
Members
449,174
Latest member
chandan4057

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top