We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,478 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

VBA Excel: change null value in any cell in a Range to zero

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!

2
Contributors
1
Reply
36 Minutes
Discussion Span
9 Months Ago
Last Updated
2
Views
amitash
Newbie Poster
8 posts since Jul 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

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
AndreRet
Industrious Poster
4,706 posts since Jan 2008
Reputation Points: 391
Solved Threads: 481
Skill Endorsements: 20

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0533 seconds using 2.66MB