> I'm the one trying to do the if a=b the copy c to d .......I appreaciate all
> the help I got............
[quoted text clipped - 24 lines]
>
> Marie
The .Value just refers to the value in the range. For example, if
cell A1 contains "Fred", the the VBA statement Range("A2").Value will
return "Fred".
Nw, the code you have been given will execute any time a change is
made in the worksheet where this code exists.
However, just judging by what is listed here and not seeing any of
your other posts, why is a formula not being used? Seems like you
could just place a formula in E1 like below and then paste down column
E as far as needed.
In E1:
=If(A1=B1,D1,"")
With the above formula, if the value in A1 is equal to the value in
B1, then the value of D1 will be displayed in E1. If A1 is not equal
to B1, then nothing will be displayed in E1.
muddan madhu - 27 May 2008 19:28 GMT
Try this
Sub test()
Range("d1").Select
Do Until Selection.Offset(0, -3).Value = ""
Selection.Value = "=IF(RC[-3]=RC[-2],RC[-1],"""")"
Selection.Offset(1, 0).Select
Loop
Range("a1").Select
End Sub
> > I'm the one trying to do the if a=b the copy c to d .......I appreaciate all
> > the help I got............
[quoted text clipped - 45 lines]
>
> - Show quoted text -
Marie - 27 May 2008 20:10 GMT
I love you....... everyone had me going from SF to Seattle by way of
Nebraska...... the hard way. I knew it had to be a simple if/then
statement. THANK YOU! THANK YOU! I've been working on this one for two
weeks........ I am eternally in your debt.
> > I'm the one trying to do the if a=b the copy c to d .......I appreaciate all
> > the help I got............
[quoted text clipped - 43 lines]
> B1, then the value of D1 will be displayed in E1. If A1 is not equal
> to B1, then nothing will be displayed in E1.
hi,
Right click your sheet tab, view code and paste this in.
It takes the used range of column A and loops through every cell in that
range and then if A1=B1 then it copies D1 to E1. If I've got that the wrong
way around then in the 2 offset statements swap the ,4 and ,3 around.
The best way to run it is after you've pasted it in close VB editor then on
the worksheet
Tools|Macro|Macros
Select 'This Workbook from the drop down
Highlight then macro name
Click OK
Sub stantial()
lastrow = Cells(Rows.Count, "A").End(xlUp).Row
Set MyRange = Range("A1:A" & lastrow)
For Each c In MyRange
If c.Value = c.Offset(, 1).Value Then
c.Offset(, 4).Value = c.Offset(, 3).Value
End If
Next
End Sub
Mike
> I'm the one trying to do the if a=b the copy c to d .......I appreaciate all
> the help I got............
[quoted text clipped - 24 lines]
>
> Marie