Noobette
New Member
- Joined
- Oct 27, 2008
- Messages
- 44
I've got an error here, and I need to modify it to perform better.
My data looks like this in column A.
<COLGROUP><COL style="WIDTH: 48pt" width=64><TBODY>
</TBODY>
The error is that the code returns "p" in each of the 10 cells in column C.
I'd like to modify it to be flexible with a variable number of rows in Column A.
Any help is appreciated!
My data looks like this in column A.
apple |
apple |
Orange |
Orange |
apple |
pear |
apple |
carrot |
Orange |
pear |
<COLGROUP><COL style="WIDTH: 48pt" width=64><TBODY>
</TBODY>
Code:
Sub WorkSheet_Fruit()
For i = 1 To 10
yum = Sheet1.Cells(i, 2).Value
If yum = "apple" Then
Sheet1.Cells(i, 3).Value = "a"
ElseIf yum = "orange" Then
Sheet1.Cells(i, 3).Value = "o"
ElseIf yum < "pear" Then
Sheet1.Cells(i, 3).Value = "p"
Else
Sheet1.Cells(i, 3).Value = "veggie"
End If
Next i
End Sub
The error is that the code returns "p" in each of the 10 cells in column C.
I'd like to modify it to be flexible with a variable number of rows in Column A.
Any help is appreciated!