Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing Data on 2 sheets Lee Excel Discussion (Misc queries) 1 November 25th 08 03:45 PM
Looping through multiple sheets and pasting data in first blank ro Dan Excel Programming 1 September 18th 08 04:23 PM
Comparing data of two sheets sriramkanala Excel Programming 0 February 9th 06 02:59 PM
Comparing data of two sheets shenlingstyle Excel Programming 0 September 29th 05 06:57 PM
Comparing sheets data Vytautas Excel Discussion (Misc queries) 1 February 15th 05 10:01 AM


All times are GMT +1. The time now is 09:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"