ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   If Null Set Value to Zero (https://www.excelbanter.com/excel-programming/400815-if-null-set-value-zero.html)

Dean P.

If Null Set Value to Zero
 

Please help me modify the VBA code listed below.

If the value for Volume is Null then return a value of zero.

Thanks,



With Sheets("Sheet1")
.Cells(RowCount, "A") = Team
.Cells(RowCount, "B") = Volume
.Cells(RowCount, "C") = Date
End With

Keith74

If Null Set Value to Zero
 


With Sheets("Sheet1")
.Cells(RowCount, "A") = Team
.Cells(RowCount, "B") = iif(isnull(Volume) = true,0,Volume)
.Cells(RowCount, "C") = Date
End With


hth

Keith


Gary''s Student

If Null Set Value to Zero
 
Sub routine()
With Sheets("Sheet1")
.Cells(RowCount, "A") = Team
If Volume = "" Then
.Cells(RowCount, "B") = 0
Else
.Cells(RowCount, "B") = Volume
End If
.Cells(RowCount, "C") = Date
End With
End Sub

--
Gary''s Student - gsnu200755


"Dean P." wrote:


Please help me modify the VBA code listed below.

If the value for Volume is Null then return a value of zero.

Thanks,



With Sheets("Sheet1")
.Cells(RowCount, "A") = Team
.Cells(RowCount, "B") = Volume
.Cells(RowCount, "C") = Date
End With



All times are GMT +1. The time now is 05:03 AM.

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