Formula to automatically change one number to another number

  • Thread starter Thread starter Caroline ERP
  • Start date Start date
C

Caroline ERP

I would like to know how I can change a number to another automatically.

I bring data into excel from another source. All the zeros which come
across I want to populate with 0.5 . I want to apply this formula to my
template so it is done automatically and I don't have to use the find and
replace function.

Thanks

Caroline
 
Try this small macro:

Sub caroline()
Dim r As Range
Dim rr As Range
Set rr = ActiveSheet.UsedRange.SpecialCells(xlCellTypeConstants)
For Each r In rr
If IsEmpty(r) Then
Else
If r.Value = 0 Then
r.Value = 0.5
End If
End If
Next
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