If Null Set Value to Zero

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
With Sheets("Sheet1")
.Cells(RowCount, "A") = Team
.Cells(RowCount, "B") = iif(isnull(Volume) = true,0,Volume)
.Cells(RowCount, "C") = Date
End With

hth

Keith
 
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
 

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