Hi JoeMo,
I have attached 5 sample worksheets below. Pls
let me know if it's possible to create a Macro to run Macro1 automatically on the 500 worksheets. Thanks.
This is Worksheet EquipmentA
[TABLE="class: grid"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]EquipmentA[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area9[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]EquipmentA[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area11[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]EquipmentA[/TD]
[TD="align: center"]PartD[/TD]
[TD="align: center"]Area9[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]EquipmentA[/TD]
[TD="align: center"]PartF[/TD]
[TD="align: center"]Area11[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]EquipmentA[/TD]
[TD="align: center"]PartB[/TD]
[TD="align: center"]Area7[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD="align: center"]EquipmentA[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area2[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD="align: center"]EquipmentA[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area8[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]9[/TD]
[TD="align: center"]EquipmentA[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area10[/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD="align: center"]10[/TD]
[TD="align: center"]EquipmentA[/TD]
[TD="align: center"]PartB[/TD]
[TD="align: center"]Area6[/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD="align: center"]11[/TD]
[TD="align: center"]EquipmentA[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area1[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]12[/TD]
[TD="align: center"]EquipmentA[/TD]
[TD="align: center"]PartC[/TD]
[TD="align: center"]Area2[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]13[/TD]
[TD="align: center"]EquipmentA[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area7[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]14[/TD]
[TD="align: center"]EquipmentA[/TD]
[TD="align: center"]PartD[/TD]
[TD="align: center"]Area11[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]15[/TD]
[TD="align: center"]EquipmentA[/TD]
[TD="align: center"]PartG[/TD]
[TD="align: center"]Area9[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]16[/TD]
[TD="align: center"]EquipmentA[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area8[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]17[/TD]
[TD="align: center"]EquipmentA[/TD]
[TD="align: center"]PartB[/TD]
[TD="align: center"]Area6[/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD="align: center"]18[/TD]
[TD="align: center"]EquipmentA[/TD]
[TD="align: center"]PartK[/TD]
[TD="align: center"]Area10[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]19[/TD]
[TD="align: center"]EquipmentA[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area10[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]20[/TD]
[TD="align: center"]EquipmentA[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area8[/TD]
[TD="align: center"]2[/TD]
[/TR]
</tbody>[/TABLE]
This is Worksheet EquipmentB
[TABLE="class: grid"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]EquipmentB[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area9[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]EquipmentB[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area8[/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]EquipmentB[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area11[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]EquipmentB[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area10[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]EquipmentB[/TD]
[TD="align: center"]PartD[/TD]
[TD="align: center"]Area9[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD="align: center"]EquipmentB[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area8[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD="align: center"]EquipmentB[/TD]
[TD="align: center"]PartF[/TD]
[TD="align: center"]Area11[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]9[/TD]
[TD="align: center"]EquipmentB[/TD]
[TD="align: center"]PartB[/TD]
[TD="align: center"]Area6[/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD="align: center"]10[/TD]
[TD="align: center"]EquipmentB[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area2[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]11[/TD]
[TD="align: center"]EquipmentB[/TD]
[TD="align: center"]PartG[/TD]
[TD="align: center"]Area9[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]12[/TD]
[TD="align: center"]EquipmentB[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area8[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]13[/TD]
[TD="align: center"]EquipmentB[/TD]
[TD="align: center"]PartD[/TD]
[TD="align: center"]Area11[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]14[/TD]
[TD="align: center"]EquipmentB[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area10[/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD="align: center"]15[/TD]
[TD="align: center"]EquipmentB[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area7[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]16[/TD]
[TD="align: center"]EquipmentB[/TD]
[TD="align: center"]PartB[/TD]
[TD="align: center"]Area6[/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD="align: center"]17[/TD]
[TD="align: center"]EquipmentB[/TD]
[TD="align: center"]PartC[/TD]
[TD="align: center"]Area2[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]18[/TD]
[TD="align: center"]EquipmentB[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area1[/TD]
[TD="align: center"]1[/TD]
[/TR]
</tbody>[/TABLE]
This is Worksheet EquipmentC
[TABLE="class: grid"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]EquipmentC[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area1[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]EquipmentC[/TD]
[TD="align: center"]PartB[/TD]
[TD="align: center"]Area6[/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]EquipmentC[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area10[/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]EquipmentC[/TD]
[TD="align: center"]PartD[/TD]
[TD="align: center"]Area11[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]EquipmentC[/TD]
[TD="align: center"]PartG[/TD]
[TD="align: center"]Area9[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD="align: center"]EquipmentC[/TD]
[TD="align: center"]PartB[/TD]
[TD="align: center"]Area6[/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD="align: center"]EquipmentC[/TD]
[TD="align: center"]PartB[/TD]
[TD="align: center"]Area7[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]9[/TD]
[TD="align: center"]EquipmentC[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area8[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]10[/TD]
[TD="align: center"]EquipmentC[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area2[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]11[/TD]
[TD="align: center"]EquipmentC[/TD]
[TD="align: center"]PartK[/TD]
[TD="align: center"]Area10[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]12[/TD]
[TD="align: center"]EquipmentC[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area8[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]13[/TD]
[TD="align: center"]EquipmentC[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area11[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]14[/TD]
[TD="align: center"]EquipmentC[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area9[/TD]
[TD="align: center"]1[/TD]
[/TR]
</tbody>[/TABLE]
This is Worksheet EquipmentD
[TABLE="class: grid"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]EquipmentD[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area1[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]EquipmentD[/TD]
[TD="align: center"]PartB[/TD]
[TD="align: center"]Area6[/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]EquipmentD[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area10[/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]EquipmentD[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area8[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]EquipmentD[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area2[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD="align: center"]EquipmentD[/TD]
[TD="align: center"]PartB[/TD]
[TD="align: center"]Area7[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD="align: center"]EquipmentD[/TD]
[TD="align: center"]PartF[/TD]
[TD="align: center"]Area11[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]9[/TD]
[TD="align: center"]EquipmentD[/TD]
[TD="align: center"]PartD[/TD]
[TD="align: center"]Area9[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]10[/TD]
[TD="align: center"]EquipmentD[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area11[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]11[/TD]
[TD="align: center"]EquipmentD[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area7[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]12[/TD]
[TD="align: center"]EquipmentD[/TD]
[TD="align: center"]PartD[/TD]
[TD="align: center"]Area11[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]13[/TD]
[TD="align: center"]EquipmentD[/TD]
[TD="align: center"]PartG[/TD]
[TD="align: center"]Area9[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]14[/TD]
[TD="align: center"]EquipmentD[/TD]
[TD="align: center"]PartB[/TD]
[TD="align: center"]Area6[/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD="align: center"]15[/TD]
[TD="align: center"]EquipmentD[/TD]
[TD="align: center"]PartK[/TD]
[TD="align: center"]Area10[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]16[/TD]
[TD="align: center"]EquipmentD[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area8[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]17[/TD]
[TD="align: center"]EquipmentD[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area10[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]18[/TD]
[TD="align: center"]EquipmentD[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area8[/TD]
[TD="align: center"]2[/TD]
[/TR]
</tbody>[/TABLE]
This is Worksheet EquipmentE
[TABLE="class: grid"]
<tbody>[TR]
[TD="align: center"][/TD]
[TD="align: center"]A[/TD]
[TD="align: center"]B[/TD]
[TD="align: center"]C[/TD]
[TD="align: center"]D[/TD]
[/TR]
[TR]
[TD="align: center"]2[/TD]
[TD="align: center"]EquipmentE[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area9[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]3[/TD]
[TD="align: center"]EquipmentE[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area11[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]4[/TD]
[TD="align: center"]EquipmentE[/TD]
[TD="align: center"]PartD[/TD]
[TD="align: center"]Area9[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]5[/TD]
[TD="align: center"]EquipmentE[/TD]
[TD="align: center"]PartF[/TD]
[TD="align: center"]Area11[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]6[/TD]
[TD="align: center"]EquipmentE[/TD]
[TD="align: center"]PartB[/TD]
[TD="align: center"]Area7[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]7[/TD]
[TD="align: center"]EquipmentE[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area2[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]8[/TD]
[TD="align: center"]EquipmentE[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area8[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]9[/TD]
[TD="align: center"]EquipmentE[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area10[/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD="align: center"]10[/TD]
[TD="align: center"]EquipmentE[/TD]
[TD="align: center"]PartB[/TD]
[TD="align: center"]Area6[/TD]
[TD="align: center"]2[/TD]
[/TR]
[TR]
[TD="align: center"]11[/TD]
[TD="align: center"]EquipmentE[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area1[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]12[/TD]
[TD="align: center"]EquipmentE[/TD]
[TD="align: center"]PartC[/TD]
[TD="align: center"]Area2[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]13[/TD]
[TD="align: center"]EquipmentE[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area7[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]14[/TD]
[TD="align: center"]EquipmentE[/TD]
[TD="align: center"]PartK[/TD]
[TD="align: center"]Area10[/TD]
[TD="align: center"]3[/TD]
[/TR]
[TR]
[TD="align: center"]15[/TD]
[TD="align: center"]EquipmentE[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area10[/TD]
[TD="align: center"]1[/TD]
[/TR]
[TR]
[TD="align: center"]16[/TD]
[TD="align: center"]EquipmentE[/TD]
[TD="align: center"]PartA[/TD]
[TD="align: center"]Area8[/TD]
[TD="align: center"]2[/TD]
[/TR]
</tbody>[/TABLE]
This is Macro1
Sub Macro1()
'
' Macro1 Macro
'
'
Range("A1").Select
ActiveCell.FormulaR1C1 = "Equipment No."
Range("B1").Select
ActiveCell.FormulaR1C1 = "Part No."
Range("C1").Select
ActiveCell.FormulaR1C1 = "Area where Part is used"
Range("D1").Select
ActiveCell.FormulaR1C1 = "Qty"
Selection.End(xlToLeft).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Application.Goto Reference:="R100C1"
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=12
Application.CutCopyMode = False
ActiveWorkbook.Worksheets("EquipmentA").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("EquipmentA").Sort.SortFields.Add Key:=Range( _
"B101:B119"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("EquipmentA").Sort
.SetRange Range("A100:D119")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
ActiveWindow.SmallScroll Down:=6
Range("B100").Select
Selection.AutoFilter
ActiveSheet.Range("$A$100:$D$119").AutoFilter Field:=2, Criteria1:="PartA"
Range("A100").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Application.Goto Reference:="R200C1"
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWindow.SmallScroll Down:=12
End Sub