sn152
Member
Hi All,
I am trying to apply nested IF formula using VBA. Below is the code that I used. But this code is missing few rows while filling the category. Please see the attached for more info.
Please help.
I am trying to apply nested IF formula using VBA. Below is the code that I used. But this code is missing few rows while filling the category. Please see the attached for more info.
Please help.
Code:
Sub Nested_If()
Dim i As Integer
Dim n As Range
Set n = Range("XFC1")
For i = 2 To n + 1
If Cells(i, 1) <= 1 Then
Cells(i, 2) = "0-1 Day"
Else
If Cells(i, 1) >= 2 And Cells(i, 1) <= 7 Then
Cells(i, 2) = "2-7 Days"
Else
If Cells(i, 1) >= 8 And Cells(i, 1) <= 10 Then
Cells(i, 2) = "8-10 Days"
Else
If Cells(i, 1) >= 11 Then
Cells(i, 2) = "+10 Days"
End If
If Cells(i, 1) = "" Then
Cells(i, 2) = ""
End If
End If
End If
End If
Next i
End Sub