From: Isis on
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
From: Dave Peterson on
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
From: Isis on
Dave Peterson <petersod(a)verizonXSPAM.net> wrote in
news:4BD70763.54A3115C(a)verizonXSPAM.net:

> 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,

Thanks for that !

If wanted to get the 'alpha' part of the reference and put it into a
variable, how would I do that ?

Thanks again thats a good problem solved.