Hi, in Excel I want to use a marco to automate a process so that for all the cells in a Range, if any cell is null, it changes to value 0. How can I achieve that? Thanks!

You can try the following code in your macro -

Dim data As String

Range("A1").Select ''Select a range to check for Null value

data = Range("A1").Value

If data = "" Then

ActiveCell.Value = "0"

Else

MsgBox "Data is OK."

End If
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.