how do I write macro to copy the value of a cell to another if va.
If you want to run it manually (or from another macro) then use this.....
Sub copy()
Dim sh1 As Worksheet, sh2 As Worksheet
Set sh1 = Worksheets("Sheet1")
Set sh2 = Worksheets("Sheet2")
If sh2.Range("A1").Value = sh1.Range("B1").Value Then
sh2.Range("E1").Value = sh1.Range("A1").Value
sh2.Range("F1").Value = sh1.Range("B1").Value
sh2.Range("G1").Value = sh1.Range("C1").Value
End If
End Sub
If you need to make it to sense the change in the cells that set the
condition then you need to trap worksheet events - repost here for support.
--
Cheers
Nigel
"Prabhu" wrote in message
...
How do I write a macro to copy the value of cell A1, B1, C1 of sheet1 to
E1,F1 & G1 of sheet2 respectively if the value of cell A1 of sheet2 is
equal
to the value of cell B1of sheet1?
|