ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   function (https://www.excelbanter.com/excel-programming/372291-function.html)

hong

function
 
I have a spreadsheet, Range from C3:AM100 some have number, some is blank.
How can I create a function, if is blank in C2:Am100, then is 0, if is not
blank, stay whatever number is.

PCLIVE

function
 

=IF(C3="",0,C3)



"hong" wrote in message
...
I have a spreadsheet, Range from C3:AM100 some have number, some is blank.
How can I create a function, if is blank in C2:Am100, then is 0, if is
not
blank, stay whatever number is.




Jim Thomlinson

function
 
Something like this...

Sub ChangeToZero()
Dim rng As Range

On Error Resume Next
Set rng = Range("C3:AM100").SpecialCells(xlCellTypeBlanks)
On Error GoTo 0

If Not rng Is Nothing Then rng.Value = 0
End Sub
--
HTH...

Jim Thomlinson


"hong" wrote:

I have a spreadsheet, Range from C3:AM100 some have number, some is blank.
How can I create a function, if is blank in C2:Am100, then is 0, if is not
blank, stay whatever number is.


stevebriz

function
 
eg:
Private Sub CommandButton1_Click()
Range("C2", "Am100").Select
For Each cell In Selection
If cell.Value = "" Then cell.Value = "0"
Next
End Sub
hong wrote:
I have a spreadsheet, Range from C3:AM100 some have number, some is blank.
How can I create a function, if is blank in C2:Am100, then is 0, if is not
blank, stay whatever number is.




All times are GMT +1. The time now is 04:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com