Excelerate2004
Programmer
Hello to all,
I have a range of cells from B2:B536 (Vertically).
There is a text value in B2 and 2 empty cells below that, text value in B5 and 2 empty cells below that,
text value in B8, 2 empty cells etc...all the way to B536
I want to be able to look in B2, B5, B8 etc. and based on what value appears in each, use IF statements to place
values in the 2 empty cells all the way to B536, this is my logic as follows:
This is what Ive attempted below, how close am I to a solution?
Or is there a better way? Does this code even work?
Thanks for any help
I have a range of cells from B2:B536 (Vertically).
There is a text value in B2 and 2 empty cells below that, text value in B5 and 2 empty cells below that,
text value in B8, 2 empty cells etc...all the way to B536
I want to be able to look in B2, B5, B8 etc. and based on what value appears in each, use IF statements to place
values in the 2 empty cells all the way to B536, this is my logic as follows:
Code:
If Sheets("Sheet3").Range("B2") = "G" Then
Sheets("Sheet3").Range("B3") = "G"
Sheets("Sheet3").Range("B4") = "G"
End If
If Sheets("Sheet3").Range("B2") = "GA" Then
Sheets("Sheet3").Range("B3") = "G"
Sheets("Sheet3").Range("B4") = "A"
End If
If Sheets("Sheet3").Range("B2") = "A" Then
Sheets("Sheet3").Range("B3") = "A"
Sheets("Sheet3").Range("B4") = "A"
End If
If Sheets("Sheet3").Range("B2") = " " Then
Sheets("Sheet3").Range("B3") = "?"
Sheets("Sheet3").Range("B4") = "?"
End If
This is what Ive attempted below, how close am I to a solution?
Or is there a better way? Does this code even work?
Code:
Dim row As Integer
row = 2
Do
'If (IsEmpty(Sheet3.Cells(row + 1, 1).Value)) Then Exit
If Sheet3.Cells("row + 2, 2") = "G" Then
Sheet3.Cells("row + 3, 2") = "G"
Sheet3.Cells("row + 4, 2") = "G"
End If
If Sheet3.Cells("row + 2, 2") = "GA" Then
Sheet3.Cells("row + 3, 2") = "G"
Sheet3.Cells("row + 4, 2") = "A"
End If
If Sheet3.Cells("row + 2, 2") = "A" Then
Sheet3.Cells("row + 3, 2") = "A"
Sheet3.Cells("row + 4, 2") = "A"
End If
If Sheet3.Cells("row + 2, 2") = " " Then
Sheet3.Cells("row + 3, 2") = "?"
Sheet3.Cells("row + 4, 2") = "?"
End If
row = row + 3
Loop
Thanks for any help