New help the create a macro or function

jpr4287

New Member
Joined
Jul 25, 2007
Messages
2
Hi
I have two seperate files
One with my production number and a second one with action code associate to the production number
My problem is for the same production number i have a lot of action code. Wath i want is to be able to ask excel to give me all action code associate to one production numbre in one cell.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Hi
Assuming prod.no in col A of sheet1 and prodno in A and action code in B of sheet 2, paste the following codes in the macro windows (Alt F11)

Code:
Sub rrr()
x = Worksheets("sheet1").Cells(Rows.Count, 1).End(xlUp).Row
y = Worksheets("sheet2").Cells(Rows.Count, 1).End(xlUp).Row
For a = 1 To x
For b = 1 To y
If Worksheets("sheet2").Cells(b, 1) = Cells(a, 1) Then
Cells(a, 2) = Cells(a, 2) & ", " & Worksheets("sheet2").Cells(b, 2)
End If
Next b
Next a
End Sub
run the macro. It will collate all action codes into col B corresponding to prod no.
ravi
Ravi.
 
Upvote 0
Hi thanks
But i have a small problem with your program if i run it un one document with two sheet it's working but in my case my values are in two different document what i have to modify in the macro to be able to run it
 
Upvote 0

Forum statistics

Threads
1,223,491
Messages
6,172,585
Members
452,468
Latest member
godlennutrition

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