OTS

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 4

Sub OTS()

'
' OTS Macro
'
Dim ct2rval, h, I, J, k, l, m, n, p, q, d, z, r, s, t As Integer
h
J
k
l
m
n
p
q
r
s
t

=
=
=
=
=
=
=
=
=
=
=

2
2
2
2
2
2
2
2
2
2
2

Dim lastrow As Long


Dim col As Integer
For col = 1 To Columns.Count
lastrow = Application.WorksheetFunction.Max(Cells(65536, col).End(xlUp).row, las
trow)
Next col
Sheets("OTS").Cells(1,
Sheets("OTS").Cells(1,
Sheets("OTS").Cells(1,
Sheets("OTS").Cells(1,
Sheets("OTS").Cells(1,
Sheets("OTS").Cells(1,
Sheets("OTS").Cells(1,
Sheets("OTS").Cells(1,
Sheets("OTS").Cells(1,
Sheets("OTS").Cells(1,
Sheets("OTS").Cells(1,
Sheets("OTS").Cells(1,
Sheets("OTS").Cells(1,
Sheets("OTS").Cells(1,
Sheets("OTS").Cells(1,

1).Value = "PART No"


2).Value = "OH"
3).Value = "OO"
4).Value = "ROP"
5).Value = "SIS"
6).Value = "Max Bucket Backlog"
7).Value = "CT2R"
8).Value = "Total supply in CT2R"
9).Value = "Backlog in CT2R"
10).Value = "90 D backlog"
11).Value = "Unscheduled backlog"
12).Value = "TTBL"
13).Value = "DAU"
14).Value = "Days of Supply"
15).Value = "BUYER"

'Sheets("OTS").Cells(1, 16).Value = lastrow

'**************************** START ROW CHECK **********************************


********************************
For I = 3 To lastrow
'***************** Projected OH(Scheduled)(RoHS) 1 and 2 cols of OTS ***********
*******
If Cells.Item(I, 2) = "Projected OH(Scheduled)(RoHS)" Then
Sheets("ots").Cells(h, 1).Value = Sheets("Detail").Cells(I, 1).Value
Sheets("ots").Cells(h, 2).Value = Sheets("Detail").Cells(I, 3).Value

h = h + 1
End If
'************************* Total OO Qty(RoHS) 3rd col of OTS *******************
****
If Cells.Item(I, 2) = "Total OO Qty(RoHS)" Then
Sheets("ots").Cells(J, 3).Value = Sheets("Detail").Cells(I, 3).Value
J = J + 1
End If
'************************** ROP 4th col of OTS *********************************
****
If Cells.Item(I, 2) = "ROP" Then
Sheets("ots").Cells(k, 4).Value = Sheets("Detail").Cells(I, 3).Value
k = k + 1
End If
'************************** SIS 5th col of OTS *********************************
****
If Cells.Item(I, 2) = "SIS" Then
Sheets("ots").Cells(l, 5).Value = Sheets("Detail").Cells(I, 3).Value
l = l + 1
End If
'************************* Max Bucket Backlog 6th col of OTS *******************
****
If Cells.Item(I, 2) = "Max Bucket Backlog" Then
Sheets("ots").Cells(m, 6).Value = Sheets("Detail").Cells(I, 3).Value
m = m + 1
End If
'************************* CT2R 7th col of OTS ********************************
****
If Cells.Item(I, 2) = "CT2R" Then
ct2rval = Sheets("Detail").Cells(I, 3).Value
Sheets("ots").Cells(n, 7).Value = Sheets("Detail").Cells(I, 3).Value
n = n + 1

End If
'************************* Total Supply CT2R 8th col of OTS *******************
*****************
If Cells.Item(I, 2) = "Total Supply (RoHS)" Then
Sheets("ots").Cells(p, 8).Value = 0
For z = 4 To ct2rval
Sheets("ots").Cells(p, 8).Value = Sheets("ots").Cells(p, 8).Value + Sheets("Deta
il").Cells(I, z).Value
Next
p = p + 1
ct2rval = 0
End If
'************************* Backlog With CT2R 9th col of OTS *******************
*****************
If Cells.Item(I, 2) = "Demand(Scheduled)(RoHS)" Then
Sheets("ots").Cells(q, 9).Value = 0
For z = 4 To ct2rval
Sheets("ots").Cells(q, 9).Value = Sheets("ots").Cells(q, 9).Value + Sheets("Deta
il").Cells(I, z).Value
Next
q = q + 1
ct2rval = 0
End If
'************** Demand(Unconstrained)(RoHS)- 90 Days 10th col of OTS **********
******
If Cells.Item(I, 2) = "Demand(Unconstrained)(RoHS)" Then
Sheets("ots").Cells(r, 10).Value = 0
For d = 4 To 94
Sheets("ots").Cells(r, 10).Value = Sheets("ots").Cells(r, 10).Value + Sheets("De
tail").Cells(I, d).Value
Next
r = r + 1

End If
'************** Unscheduled BKG(Scheduled)(RoHS) 11th col of OTS ***************
******
If Cells.Item(I, 2) = "Unscheduled BKG(Scheduled)(RoHS)" Then
Sheets("ots").Cells(s, 11).Value = Sheets("Detail").Cells(I, 3).Value
s = s + 1
End If
'******************** DAU 13th Col of OTS *************************************
'--------------- NOT YET CODED ------------------------'********************** Days of Suplly 14th Col of OTS ****************
'---------- NOT YET CODED ---------------------------------'************************** BUYER 15th col of OTS ******************************
*******
If Cells.Item(I, 2) = "Buyer" Then
Sheets("ots").Cells(t, 15).Value = Sheets("Detail").Cells(I, 3).Value
t = t + 1
End If
'**************************** END OF ONE ROW ***********************************
*****************************************
Next
'
End Sub

You might also like