I need to generate numbers into column F, based on hierarchy (col B:D). Below is excel examaple and also result/values which should I get.
I know only how to display values for Level1. Here is my code:
ws_c = ws1.Cells(ws1.Rows.Count, "D").End(xlUp).Row
Dim Lev1 As Long, Lev2 As Long, Lev3 As Long
Lev1 = 1
For i = 3 To ws_c
If ws1.Range("B" & i).Value <> "" Then
ws1.Range("F" & i).Value = Lev1
Lev1 = Lev1 + 1
End If
Next
finally I did it: