Filling in blanks

  • Thread starter Thread starter trickdos
  • Start date Start date
T

trickdos

I am trying to fill in blanks in a range, with a value of 0. Can anyon
help. I have been looking at isempty formulas, and cant figure it out
I appreciate your help.

Bret
 
Hi Brett
not really sure what you're trying to do. You want to FILL blanks?
 
This will put a 0 in each cell in the current selection that is blank and
does not have a formula in it:

Sub test()
Dim cell As Range
For Each cell In Selection
If Not cell.HasFormula And cell.Value = "" Then
cell.Value = 0
End If
Next cell

End Sub

hth,

Doug Glancy
 
Hi Brett,

You can readily accomplish this manually:

Function key F5 | Alt sk | Enter | 0 | Ctl Enter

If you need to do this in VBA, the equivalent would be:

Sub Test()
On Error Resume Next
Selection.SpecialCells(xlCellTypeBlanks).Value = 0
On Error GoTo 0
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top