Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to only change specific cells
Hi,
This is a follow up question to a previous question I had around macros. Not sure if I should use a macro or a function in this case. I have File 1 (master file) with a total of 1000 rows, and File 2 (which contains 20 of the 1000 rows) -- identical columns For example: File 1 Name ID A 1 B 2 C 3 D 4 E 5 File 2 Name ID Changed (extra column) A 1 No C 6 Yes D 4 No How can I create a macro/function to only change the ID cell for "C"? I have inserted a "changed" column in File 2 to help me identify those that have changed. Thanks! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro to only change specific cells
Hi
not sure if this is the best way to approach this, but one option would be (ensure both files are open) in File 1 column C use the formula =IF(ISNA(VLOOKUP(A2,[File2]Sheet2!$A$2:$B$20,2,0)),B2,VLOOKUP(A2,[File2]Sheet2!$A$2:$B$20,2,0)) and copy the formula down (move your cursor over the bottom right hand corner of the cell, when you see a +, double click) all of column C in File 1 - this will put the value in from File 2 if there is one, or it will put the value in from column B if the value isn't found in File 2. Once you've checked the results in column C, you can copy them and then edit /paste special - values back over column B if you so wish. -- Cheers JulieD check out www.hcts.net.au/tipsandtricks.htm ....well i'm working on it anyway "THT" wrote in message ... Hi, This is a follow up question to a previous question I had around macros. Not sure if I should use a macro or a function in this case. I have File 1 (master file) with a total of 1000 rows, and File 2 (which contains 20 of the 1000 rows) -- identical columns For example: File 1 Name ID A 1 B 2 C 3 D 4 E 5 File 2 Name ID Changed (extra column) A 1 No C 6 Yes D 4 No How can I create a macro/function to only change the ID cell for "C"? I have inserted a "changed" column in File 2 to help me identify those that have changed. Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Change a specific code to generic in VB macro | Excel Discussion (Misc queries) | |||
how to change the value of some cells, if one specific cell value isthere. | Excel Discussion (Misc queries) | |||
Email Macro specific Cells? | Excel Worksheet Functions | |||
Run Macro from specific cells | Excel Programming | |||
getting a macro to run when a change is made to a specific row | Excel Programming |