Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Comparing 4 columns on Two different worksheets.




I am trying to create a macro that will compare the data in Cells A
through D on two different sheets. Then post the results on a third
page.

The problem I am haveing is that there will be blanks on both reports
that can not be deleted. For instance on sheet 1 column A3 and A4 maybe
blank but they are assinged to the DATA in B3 and B4. But sheet 2 has
values for this.

I have tried the VLOOP function and that does not seem to be working the
way I need it too.

I have tried many different ways and seem to be getting no where. I
have been working on this project for about a year and I have scrapped
aleast 20 different concepts.

I am running out of paitence. Any Help would be greatly appreciated.

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Comparing 4 columns on Two different worksheets.

Your post is a little vague as to what you expect to see on sheet 3 but
maybe you can work with this and get what you need. Change sheet names to
suit your purposes.

Sub colCompare()
Dim lr1 As Long, lr2 As Long
Dim sh1 As Worksheet, sh2 As Worksheet
Dim sh3 As Worksheet
Set sh1 = Sheets("Sheet1")
Set sh2 = Sheets("Sheet2")
Set sh3 = Sheets("Sheet3")
lr1 = sh1.Cells(Rows.Count, 1).End(xlUp).Row
lr2 = sh2.Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To lr1
For j = 1 To 4
If sh1.Cells(i, j) < "" And sh2.Cells(i, j) < "" Then
If sh1.Cells(i, j).Value = sh2.Cells(i, j).Value Then

sh3.Cells(i, j) = "Match"
Else
sh3.Cells(i, j) = "No Match"
End If
End If
Next
Next
End Sub



"Jimbob B" wrote in message
...


I am trying to create a macro that will compare the data in Cells A
through D on two different sheets. Then post the results on a third
page.

The problem I am haveing is that there will be blanks on both reports
that can not be deleted. For instance on sheet 1 column A3 and A4 maybe
blank but they are assinged to the DATA in B3 and B4. But sheet 2 has
values for this.

I have tried the VLOOP function and that does not seem to be working the
way I need it too.

I have tried many different ways and seem to be getting no where. I
have been working on this project for about a year and I have scrapped
aleast 20 different concepts.

I am running out of paitence. Any Help would be greatly appreciated.

*** Sent via Developersdex http://www.developersdex.com ***



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 TWO COLUMNS OF INFORMATION, ACROSS TWO WORKSHEETS Susan Excel Worksheet Functions 2 January 5th 09 11:25 PM
Comparing columns from 2 different worksheets. Alant Excel Worksheet Functions 1 June 8th 06 03:51 AM
Comparing columns in 2 different worksheets, IF Function Laura Excel Worksheet Functions 2 February 16th 06 09:59 PM
Comparing two worksheets with two columns each for duplicates jlcnewyork Excel Discussion (Misc queries) 0 February 15th 06 02:32 PM
Comparing two columns in two different worksheets stevel Excel Worksheet Functions 4 May 31st 05 01:43 PM


All times are GMT +1. The time now is 08:03 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"