Hello everyone,
I'm adding sequential lettering to every cell greater than 0 in the loop, that part works fine. What I can't figure out how to do is reset the lettering to "a" every time "bcell" hits column D. The highlighted text is me fumbling around at a solution, without the blue text the loop works just fine.
Any help appreciated
Thanks,
Jordan
I'm adding sequential lettering to every cell greater than 0 in the loop, that part works fine. What I can't figure out how to do is reset the lettering to "a" every time "bcell" hits column D. The highlighted text is me fumbling around at a solution, without the blue text the loop works just fine.
Code:
Private Sub CommandButtonTest_Click()Dim bcell As Range
Dim c As String * 1 'this and next line are alphabet counter
c = "a"
For Each bcell In Sheet2.Range("d3:ge50")
With bcell
[COLOR=#0000ff] If bcell = Sheet2.Range(D & bcell.Row) Then[/COLOR]
[COLOR=#0000ff] c = "a"[/COLOR]
ElseIf bcell.Interior.ColorIndex = 2 And bcell.Value > 0 Then
bcell = c & bcell
c = Chr(Asc(c) + 1)
ElseIf bcell.Interior.ColorIndex = 53 And bcell.Value > 0 Then
bcell = c & bcell
c = Chr(Asc(c) + 1)
ElseIf bcell.Interior.ColorIndex = 24 And bcell.Value > 0 Then
bcell = c & bcell
bcell.Offset(0, 1) = c & bcell.Offset(0, 1)
c = Chr(Asc(c) + 1)
End If
End With
Next bcell
End Sub
Any help appreciated
Thanks,
Jordan