Compare two numbers and fill third cell and one more which I dont know

Nikkei

New Member
Joined
Oct 19, 2009
Messages
2
First off, I am glad to be here.Hopefully I wil get some good advice. Sorry if I seem a bit noobish It's unintentional.

Ok, so, I need to make in excel the following.
I have in one sheet 8 columns with random numbers from 1 to 50 and about 300 rows.
In another sheet I have the numbers 1-50 in the top row and all the 300 rows as in the first sheet.
I want to be able to fill the cells with black on each cell where the number is in the first sheet.
So instead of having eight columns with values as in the first sheet I will have eight black boxes per row with the value at the top.

And lastly:
I want to establish how many times did the numbers 1 and 2, 1 and 3 etc. found themselves in the same row and put that value in a separate sheet.

That's about it I guess, I really don't know if this can be made either with formulas or VBA (either way formulas I know a bit but VBA no realy)

Thanks in advance.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
This can blacken the cells. I'm not really sure what you're asking for in the last part of your post.

Code:
Option Explicit

Sub BlackenRows()
    
    Dim iCtr As Integer
    Dim iSubCtr As Integer
    Dim iVal As Integer
    
    For iCtr = 1 To Worksheets(1).Range("A1").SpecialCells(xlLastCell).Rows
        For iSubCtr = 1 To Worksheets(1).Range("A1").SpecialCells(xlLastCell).Columns
            
            iVal = Worksheets(1).Cells(iCtr, iSubCtr).Value
            
            Worksheets(2).Cells(1, iVal).Interior.ColorIndex = 1
            
        Next iSubCtr
    Next iCtr
        
End Sub
 
Upvote 0
Thanks for your reply, I tried your script but it only colors the A1 in the second sheet and as for my second request it goes something like this
Sheet 1
1,2,3,4,5,6,7,8
9,2,3,1,4,5,7,6
6,7,1,2,3,8,5,6,10
etc.
=> Sheet 2
1,2 = 3 times; 1,3 = 3 times; 1,10 = 1 time
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,806
Members
449,048
Latest member
greyangel23

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