compare columns in two different sheets.

Gangster

New Member
Joined
Apr 15, 2014
Messages
23
HELLO GURUS,
im very new to VBA macro. i have a task to be done. i have two sheets in same workbook.
In each sheet i have a 20*8 matrix table with data.
i need to compare column B and C from sheet1 to all the values in column B and C in sheet.
for ex: sheet1
B(2,2) and C(2,3) to any rows in column B and C.
if they match i need to retrieve data from column say D to H from sheet1 and place it in sheet2.
 
Gangster,

Sorry, but, I do not understand what your are trying to do with your latest workbook.

Click on the Reply to Thread button, and just put the word BUMP in the thread. Then, click on the Post Quick Reply button, and someone else will assist you.
 
Upvote 0

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Hi hiker95,
One last question..

1. I have table of 10*5... i need to sort them using(coulmn DD with the condition that it should be greater then or equal to 5. lesser can be deleted)
2. After each sorting, i need to insert a new line.

AABBCCDDEE
fruitroundxxxapplered
fruitlongyyybananayellow
fruitroundxxxapplered
fruitroundxxxapplered
fruitlongyyybananayellow
fruitroundxxxapplered
fruitlongyyybananayellow
fruitroundxxxapplered
fruitlongyyybananayellow

<tbody>
</tbody>


output:

AABBccddee
fruitlongyyybananayellow
fruitlongyyybananayellow
fruitlongyyybananayellow
fruitlongyyybananayellow

<tbody>
</tbody>
fruitlongyyybananayellow

<tbody>
</tbody>

AABBccddee
fruitroundxxxapplered
fruitroundxxxapplered
fruitroundxxxapplered
fruitroundxxxapplered

<tbody>
</tbody>
fruitroundxxxapplered

<tbody>
</tbody>

Thanks in advance...
 
Upvote 0
Gangster,

In this thread we have gone thru 4 changes/requests to where the raw data is, and, what the results should be.

And, I find it difficult to follow your logic/instructions to solve these requests.


I would reccomend that you start a NEW thread with your current request, with the following:

1. What version of Excel and Windows are you using?

2. Are you using a PC or a Mac?

3. Screenshots of all worksheet before and after a macro, using the following:

To post your data, you can download and install one of the following two programs:
Excel Jeanie
http://www.mrexcel.com/htmlmaker.html

Or, when using Internet Explorer, just put borders around your data in Excel and copy those cells into your post.
See reply #2 the BLUE text in the following link:
http://www.mrexcel.com/forum/about-board/444901-how-create-table-like-aladin.html#post2198045

If you are not able to give us screenshots:
You can upload your workbook to Box Net,
sensitive data changed
mark the workbook for sharing
and provide us with a link to your workbook.


4. Detailed instuctions off to the side of the raw data (not in between the sections in worksheets).

5. Then send me a Private Message with a link to the NEW thread, and, I will have a look.


If you are not able to do the above, then:

Click on the Reply to Thread button, and just put the word BUMP in the thread. Then, click on the Post Quick Reply button, and someone else will assist you.
 
Upvote 0
The following code will compare two worksheets and put the results on a third, new worksheet. If the values are the same on both sheets, the new sheet will have a 1 in that cell, if not, a 0.

1. open a new excel book and copy your two sheets that you want to compare into the book. delete all other sheets excep for the two to compare.
2. press alt+f11
3. press alt+i
4. press m
5. paste the following code and press f5 to run it.

Code:
Sub compare()
Sheets(1).Select
Sheets.Add
Dim cell As Range
Dim rng As Range
Set rng = Sheets(2).Range("A1:AH250")
For Each cell In rng
    cellAddress = cell.Address
    If cell = Sheets(3).Range(cellAddress) Then
        Sheets(1).Range(cellAddress) = 1
    Else
        Sheets(1).Range(cellAddress) = 0
    End If
Next cell

End Sub
 
Upvote 0
HI pedvito3,
Thank yu fr the reply..Well i think my problem is not clearly explained here..
So I have created a new thread. This will clearly tell you the problem statement....

The link is

773041-sorting-cells-condition-if-count-%3D-5-a.html


http://www.mrexcel.com/forum/excel-questions/773041-sorting-cells-condition-if-count-=-5-a.html

Sorry for the confusion...

Thanks in advance :)
 
Upvote 0

Forum statistics

Threads
1,215,387
Messages
6,124,637
Members
449,177
Latest member
Sousanna Aristiadou

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top