gingerafro
Active Member
- Joined
- Mar 23, 2005
- Messages
- 448
Hi.
I'm trying to put some bones on my 'layman's VBA'. I would like to know how to use a For Each statement with cells, and if the fit the criteria, do something with them. What I do isn't actually important, its the method I'm interested in. My badly written VBA would be:
sub selectcells()
dim c as Cells (I know the 'Cells' bit doesn't exist)
with worksheets("Sheet1")
For Each c in .Range("A1:A10")
IF c.value = 5 then
c.select
End IF
Next
End With
End Sub
I'm trying to put some bones on my 'layman's VBA'. I would like to know how to use a For Each statement with cells, and if the fit the criteria, do something with them. What I do isn't actually important, its the method I'm interested in. My badly written VBA would be:
sub selectcells()
dim c as Cells (I know the 'Cells' bit doesn't exist)
with worksheets("Sheet1")
For Each c in .Range("A1:A10")
IF c.value = 5 then
c.select
End IF
Next
End With
End Sub