Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
write a copy/paste from one workbook to another in a macro | Excel Discussion (Misc queries) | |||
Saving a copy of excel file in macro but have it auto write | Excel Worksheet Functions | |||
How to write a simple copy-paste macro? | New Users to Excel | |||
is it possible to execute write to the fields in another .xsl form a macro in another .xsl? e.g. some way to load another .xsl into an .xsl macro and write to its data? | Excel Worksheet Functions | |||
Write a macro ro copy column at certain time of day. | Excel Programming |