View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default reference cells when looping

tcell.offset(0,2).value = 2



Isis wrote:

Using a loop like this

For Each tcell In Range("A4:A17").Cells
If tcell.Value = "Danny" Then
'Write a value into column 2 columns to the right
End If
Next

I want to write a value into the column 2 columns to the right of the
current column and on the same row but I am not sure how to reference
that cell in my code.

So if I find the value "Danny" (as above) in cell A8 - I want to write
the value "2" into cell A10.

Any help appreciated

Thanks


--

Dave Peterson