LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 65
Default Compare multiple columns in two workbooks?

I regularly update a workbook that has manually inserted comments down
one column. To update, I get a new report from the database, then run
a macro that arranges and formats certain report columns into a
summary master workbook. So far, so good.

Than I have to copy across the comments. Sometimes new data is added
into or subtracted from the middle of the data range, so it's not as
simple as copying everything over and anything at the bottom is new.

As far as I can see, I would need to make a comparison string of 4 or
5 columns across a single row in the updated summary, then find this
in the previous summary and copy across the comment that is in the row
where the comparison matched. I could see a brute force matchup along
the lines of:

rwNew = count of rows in new
rwPrev = count of rows in previous
' x refers to range in new book
'y refers to range in previous book
For x = 1 To rwNew
For y = 1 To rwPrev
strNew = Values of Cells(x,4) through Cells(x,8)
strPrev = Values of Cells(y,4) through Cells(y,8)
If strPrev = strNew Then
Cell(x,10) = Cell(y,10)
Exit For
End If
Next y
Next x

Is there a better, faster, easier way to accomplish this?
Ed

 
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
Compare columns from different workbooks ken957 Excel Discussion (Misc queries) 1 June 24th 08 09:24 PM
Compare lists in Multiple workbooks TimJames Excel Worksheet Functions 0 June 21st 07 06:26 PM
compare multiple columns jrm Excel Discussion (Misc queries) 3 August 20th 06 03:51 PM
how do I compare columns in two different workbooks? Provider98122 Excel Discussion (Misc queries) 5 March 10th 05 03:33 AM
Compare two columns in two different workbooks Keenman Excel Programming 4 September 10th 04 07:19 AM


All times are GMT +1. The time now is 05:06 AM.

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"