ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   cell = null if conditions apply (https://www.excelbanter.com/excel-programming/298075-cell-%3D-null-if-conditions-apply.html)

Weng-Kit Tan

cell = null if conditions apply
 
Hi,

Like to pose a question to everyone here. With the codes below, I
would like to let dcheckerror be null if theVals(i,2) returns a value
that is not numeric. Currently, the codes causes the return of the
number 999999 is the value returned is not numeric.

In addition, how can I ensure that if the value returned to the cell
is #N/A Tim or #N/A Sec, it also becomes null?

Think it's to do with the following lines of codes below, and to add
certain checks to these lines of codes.

If Not IsNumeric(theVals(i, 2)) Then
dcheckerror = 999999

Pls help, thanks.

Best regards,
Gerard

****************

With ActiveSheet
noRows = Application.CountA(.Columns(1))
AdjustednoRows = noRows + 2
theVals = .Range(.Cells(3, 1), .Cells(AdjustednoRows&, 2))
End With

For i = 1 To noRows
If Not IsNumeric(theVals(i, 2)) Then
dcheckerror = 999999
Else
dcheckerror = theVals(i, 2)
End If
RTUpdate CStr(theVals(i, 1)), dcheckerror ' CDbl(theVals(i, 2))
Next i

****************


All times are GMT +1. The time now is 09:24 PM.

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