if then loop
Re Stewart's reply .... I have removed the "Cell(i,i)=1' statements
Private Sub one_Click()
For i = 27 To 999
If Cells(i, 1).Value = "More" Then <=== Look in colum A ?
Cells(i, 1).Value = Sheets("Prices").Range("A3")
Cells(i, 3).Value = Sheets("Prices").Range("B3")
Cells(i, 4).Value = Sheets("Prices").Range("C3")
Exit For
End If
Next i
End Sub
But this code does not:
Private Sub CommandButton6_Click()
For i = 31 To 999
If Cells(i, 2).Value = "Fruit" Then <=== Look in Column B ?
Range("AD12").Select
Application.CutCopyMode = False
Selection.Copy
Range ("i, 2"). Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Exit For
End If
Next i
" wrote:
So, I need to change the second i to something less than 256?
Believe it or not, the first piece of code works, but I want to do it
correctly.
And since my post, I got the second piece of code to work with the
Cells (i, i) = i code
But,
Since I am only searching one column on every row, can I use:
Cells(i, 2) = i
Because I tried that and it did not work
Thanks, all of the quick replies are most helpful!
Vince
|