![]() |
how do I write macro to copy the value of a cell to another if va.
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? |
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? |
how do I write macro to copy the value of a cell to another if va.
You don't need a macro
Sheet2!E1: = IF(A1=Sheet1!B1,Sheet1!A1,"") etc. -- HTH Bob Phillips "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? |
how do I write macro to copy the value of a cell to another if va.
This is a good example of the value of the discussion group. If the data is
updated frequently, then Bob Phillips solution is good because €śthe result€ť responds automatically to the updates. If €śthe result€ť needs to be exported, then Nigels solution is good because it produces a snapshot with no links to remove. -- Gary's Student "Prabhu" wrote: 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? |
All times are GMT +1. The time now is 11:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com