Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping through sheets and comparing data
Hi,
I am trying to get a macro that loops through the worksheets in the workbook and compares the values in the same cells in each...in other words, it compares the value in G3 of Sheet 2 with the value cell G3 in all the other sheets. When a match is found, I need the value in O3 from the matching sheet copied into O3 on the original worksheet (this macro would only be run from one worksheet, either by clicking a button or by running automatically when a value is entered into a certain cell). Thanks! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Looping through sheets and comparing data
I think this is what you want. Not sure which direction yo uwant to copy the
O3 value. I think you want to write to Sheet2. Sub FixO3() MatchValue = Sheets("Sheet2").Range("G3") for each sht in sheets if sht.name < "Sheet2" then Sheets("Sheet2").Range("O3") =sht.Range("O3") end if next sht end sub "TomK76" wrote: Hi, I am trying to get a macro that loops through the worksheets in the workbook and compares the values in the same cells in each...in other words, it compares the value in G3 of Sheet 2 with the value cell G3 in all the other sheets. When a match is found, I need the value in O3 from the matching sheet copied into O3 on the original worksheet (this macro would only be run from one worksheet, either by clicking a button or by running automatically when a value is entered into a certain cell). Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Comparing Data on 2 sheets | Excel Discussion (Misc queries) | |||
Looping through multiple sheets and pasting data in first blank ro | Excel Programming | |||
Comparing data of two sheets | Excel Programming | |||
Comparing data of two sheets | Excel Programming | |||
Comparing sheets data | Excel Discussion (Misc queries) |