PDA

View Full Version : [SOLVED:] Blank cell



idnoidno
08-28-2017, 12:37 AM
"I" column blank cells after the implementation of the code, did not produce blank results(the answer is 16), how to adjust the code?
20194

offthelip
08-28-2017, 01:54 AM
Change the order in which you do the test then it will work:


Dim i, irow
irow = Cells(Rows.Count, "g").End(xlUp).Row
Range("k:k").ClearContents
For i = 5 To irow
If Cells(i, 7) < 0 Then
Cells(i, 11) = -Cells(i, 7)
ElseIf Cells(i, 7) = "" Then
Cells(i, 11) = ""
ElseIf Cells(i, 7) = 0 Then
Cells(i, 11) = 16
ElseIf Cells(i, 7) > 16 Then
Cells(i, 11) = Cells(i, 7) - 16

End If
Next i

mdmackillop
08-28-2017, 01:55 AM
Personally, I would use Select Case for such.

idnoidno
08-28-2017, 02:11 AM
Change the order in which you do the test then it will work.What a magical thing is.