Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'Align Colums
- Columns("A").ColumnWidth = 0.94
- Columns("B").ColumnWidth = 0.94
- Columns("C").ColumnWidth = 0.94
- Columns("D").ColumnWidth = 0.94
- Columns("E").ColumnWidth = 0.94
- Columns("F").ColumnWidth = 0.94
- Columns("G").ColumnWidth = 0.94
- Columns("H").ColumnWidth = 0.94
- Columns("I").ColumnWidth = 0.94
- Columns("J").ColumnWidth = 0.94
- Columns("K").ColumnWidth = 0.94
- Columns("L").ColumnWidth = 0.94
- Columns("M").ColumnWidth = 0.94
- Columns("N").ColumnWidth = 0.94
- Columns("O").ColumnWidth = 0.94
- Columns("P").ColumnWidth = 0.94
- Columns("Q").ColumnWidth = 0.94
- Columns("R").ColumnWidth = 0.94
- Columns("S").ColumnWidth = 0.94
- Columns("T").ColumnWidth = 0.94
- Columns("U").ColumnWidth = 0.94
- Columns("V").ColumnWidth = 0.94
- Columns("W").ColumnWidth = 0.94
- Columns("X").ColumnWidth = 0.94
- Columns("Y").ColumnWidth = 0.94
- Columns("Z").ColumnWidth = 0.94
- Columns("AA").ColumnWidth = 0.94
- Columns("AB").ColumnWidth = 0.94
- Columns("AC").ColumnWidth = 0.94
- Columns("AD").ColumnWidth = 4.33
- Columns("AE").ColumnWidth = 0.94
- Columns("AF").ColumnWidth = 0.94
- Columns("AG").ColumnWidth = 0.94
- Columns("AH").ColumnWidth = 0.94
- Columns("AI").ColumnWidth = 0.94
- Columns("AJ").ColumnWidth = 0.94
- Columns("AK").ColumnWidth = 0.94
- Columns("AL").ColumnWidth = 0.94
- Columns("AM").ColumnWidth = 0.94
- Columns("AN").ColumnWidth = 0.94
- Columns("AO").ColumnWidth = 0.94
- Columns("AP").ColumnWidth = 0.94
- Columns("AQ").ColumnWidth = 0.94
- Columns("AR").ColumnWidth = 0.94
- Columns("AS").ColumnWidth = 0.94
- Columns("AT").ColumnWidth = 0.94
- Columns("AU").ColumnWidth = 0.94
- Columns("AV").ColumnWidth = 0.94
- Columns("AW").ColumnWidth = 0.94
- Columns("AX").ColumnWidth = 0.94
- Columns("AY").ColumnWidth = 0.94
- Columns("AZ").ColumnWidth = 0.94
- Columns("BA").ColumnWidth = 0.94
- Columns("BB").ColumnWidth = 0.94
- Columns("BC").ColumnWidth = 0.94
- Columns("BD").ColumnWidth = 0.94
- Columns("BE").ColumnWidth = 0.94
- Columns("BF").ColumnWidth = 0.94
- Columns("BG").ColumnWidth = 0.94
- 'Font Settings
- Range(Cells(14, 1), Cells(moduleStart + 40, 58)).Font.Size = 11
- Range(Cells(14, 1), Cells(moduleStart + 40, 58)).Font.Name = "Times New Roman"
- Cells(moduleStart + 4, 18).Value = "Delivery Charge"
- Range(Cells(moduleStart + 4, 18), Cells(moduleStart + 14, 18)).Font.Size = 10
- Range(Cells(moduleStart + 4, 18), Cells(moduleStart + 14, 18)).Font.Name = "Arial"
- moduleStart = 16
- standardSheets = 16
- mySheets = Worksheets.Count
- leaseSheet = "Lease Price Model 2.0"
- For i = standardSheets To mySheets
- 'Align Rows
- Rows(moduleStart).RowHeight = 12
- Rows(moduleStart + 1).RowHeight = 6.6
- 'Thick Side Border
- With Worksheets(leaseSheet).Range(Cells(moduleStart, 58), Cells(moduleStart, 58)).Borders(xlEdgeRight)
- .LineStyle = xlContinuous
- .Weight = xlMedium
- End With
- With Worksheets(leaseSheet).Range(Cells(moduleStart - 1, 58), Cells(moduleStart - 1, 58)).Borders(xlEdgeRight)
- .LineStyle = xlContinuous
- .Weight = xlMedium
- End With
- Range(Cells(moduleStart, 2), Cells(moduleStart, 13)).Merge
- Range(Cells(moduleStart, 15), Cells(moduleStart, 24)).Merge
- Range(Cells(moduleStart, 30), Cells(moduleStart, 39)).Merge
- Range(Cells(moduleStart, 45), Cells(moduleStart, 54)).Merge
- moduleStart = moduleStart + 2
- Next i
- 'Underline
- With Worksheets(leaseSheet).Range(Cells(moduleStart - 2, 15), Cells(moduleStart - 2, 24)).Borders(xlEdgeBottom)
- .LineStyle = xlContinuous
- .Weight = xlThin
- End With
- With Worksheets(leaseSheet).Range(Cells(moduleStart - 2, 30), Cells(moduleStart - 2, 39)).Borders(xlEdgeBottom)
- .LineStyle = xlContinuous
- .Weight = xlThin
- End With
- With Worksheets(leaseSheet).Range(Cells(moduleStart - 2, 45), Cells(moduleStart - 2, 54)).Borders(xlEdgeBottom)
- .LineStyle = xlContinuous
- .Weight = xlThin
- End With
- 'Align Footer Row above totals
- Rows(moduleStart - 1).RowHeight = 6.6
- 'Merging totals
- Range(Cells(moduleStart, 15), Cells(moduleStart, 24)).Merge
- Range(Cells(moduleStart, 30), Cells(moduleStart, 39)).Merge
- Range(Cells(moduleStart, 45), Cells(moduleStart, 54)).Merge
- 'Borders for totals
- Range(Cells(moduleStart, 15), Cells(moduleStart, 24)).BorderAround ColorIndex:=1, Weight:=xlThin
- Range(Cells(moduleStart, 30), Cells(moduleStart, 39)).BorderAround ColorIndex:=1, Weight:=xlThin
- Range(Cells(moduleStart, 45), Cells(moduleStart, 54)).BorderAround ColorIndex:=1, Weight:=xlThin
- 'Add Footer
- Cells(moduleStart, 13).Value = "Totals"
- Cells(moduleStart, 13).Font.Bold = True
- Range(Cells(moduleStart, 13), Cells(moduleStart, 13)).HorizontalAlignment = xlRight
- 'Equipment Sub Total
- Cells(moduleStart + 2, 13).Value = "Equipment Sub-Total"
- Cells(moduleStart + 2, 13).Font.Bold = True
- Range(Cells(moduleStart + 2, 13), Cells(moduleStart + 2, 13)).HorizontalAlignment = xlRight
- Range(Cells(moduleStart + 2, 26), Cells(moduleStart + 2, 35)).Merge
- Range(Cells(moduleStart + 2, 26), Cells(moduleStart + 2, 35)).BorderAround ColorIndex:=1, Weight:=xlThin
- Range(Cells(moduleStart + 2, 46), Cells(moduleStart + 2, 55)).Merge
- Range(Cells(moduleStart + 2, 46), Cells(moduleStart + 2, 55)).BorderAround ColorIndex:=1, Weight:=xlThin
- 'Delivery Charge
- Cells(moduleStart + 4, 18).Value = "Delivery Charge"
- Range(Cells(moduleStart + 4, 27), Cells(moduleStart + 4, 35)).Merge
- Range(Cells(moduleStart + 4, 18), Cells(moduleStart + 4, 18)).HorizontalAlignment = xlRight
- Range(Cells(moduleStart + 4, 27), Cells(moduleStart + 4, 35)).BorderAround ColorIndex:=1, Weight:=xlThin
- 'Removal Charge
- Cells(moduleStart + 5, 18).Value = "Removal Charge"
- Range(Cells(moduleStart + 5, 18), Cells(moduleStart + 5, 18)).HorizontalAlignment = xlRight
- Range(Cells(moduleStart + 4, 27), Cells(moduleStart + 4, 35)).Merge
- 'Service Allocation
- Cells(moduleStart + 6, 18).Value = "Service Allocation"
- Range(Cells(moduleStart + 6, 18), Cells(moduleStart + 6, 18)).HorizontalAlignment = xlRight
- 'Marketing Promotion
- Cells(moduleStart + 7, 18).Value = "Marketing Promotion"
- Range(Cells(moduleStart + 7, 18), Cells(moduleStart + 7, 18)).HorizontalAlignment = xlRight
- 'Trade-In Amount (Discount)
- Cells(moduleStart + 8, 18).Value = "Trade-In Amount (Discount)"
- Range(Cells(moduleStart + 8, 18), Cells(moduleStart + 8, 18)).HorizontalAlignment = xlRight
- 'Provincial Environmental Levy
- Cells(moduleStart + 9, 18).Value = "Provincial Environmental Levy"
- Range(Cells(moduleStart + 9, 18), Cells(moduleStart + 9, 18)).HorizontalAlignment = xlRight
- 'Net Equipment Value
- Range(Cells(moduleStart + 10, 27), Cells(moduleStart + 10, 35)).Merge
- Cells(moduleStart + 10, 18).Value = "Net Equipment Value"
- Cells(moduleStart + 10, 18).Font.Bold = True
- Range(Cells(moduleStart + 10, 27), Cells(moduleStart + 10, 35)).BorderAround ColorIndex:=1, Weight:=xlThin
- Range(Cells(moduleStart + 10, 18), Cells(moduleStart + 10, 18)).HorizontalAlignment = xlRight
- 'Settlement Amount
- Cells(moduleStart + 11, 18).Value = "Settlement Amount"
- Range(Cells(moduleStart + 11, 18), Cells(moduleStart + 11, 18)).HorizontalAlignment = xlRight
- 'Discretionary Items
- Cells(moduleStart + 12, 18).Value = "Discretionary Items"
- Range(Cells(moduleStart + 12, 18), Cells(moduleStart + 12, 18)).HorizontalAlignment = xlRight
- 'Invoice Price
- Range(Cells(moduleStart + 14, 27), Cells(moduleStart + 14, 35)).Merge
- Cells(moduleStart + 14, 18).Value = "Invoice Price"
- Cells(moduleStart + 14, 18).Font.Bold = True
- Range(Cells(moduleStart + 14, 18), Cells(moduleStart + 14, 18)).HorizontalAlignment = xlRight
- Range(Cells(moduleStart + 14, 27), Cells(moduleStart + 14, 35)).BorderAround ColorIndex:=1, Weight:=xlThin
- 'Lease Pricing Model (Ricoh Non-Note)
- Range(Cells(moduleStart + 16, 1), Cells(moduleStart + 16, 58)).Merge
- Range(Cells(moduleStart + 16, 1), Cells(moduleStart + 16, 58)).Interior.ColorIndex = 6
- Range(Cells(moduleStart + 16, 1), Cells(moduleStart + 16, 58)).BorderAround ColorIndex:=1, Weight:=xlThin
- 'Please enter amounts in green boxes
- Cells(moduleStart + 17, 2).Value = "Please enter amounts in green boxes"
- 'Equipment Value
- Cells(moduleStart + 18, 22).Value = "Equipment Value"
- 'New Equipment
- Cells(moduleStart + 19, 2).Value = "New Equipment"
- Range(Cells(moduleStart + 19, 20), Cells(moduleStart + 19, 32)).Merge
- Range(Cells(moduleStart + 19, 20), Cells(moduleStart + 19, 32)).BorderAround ColorIndex:=1, Weight:=xlThin
- 'Used/Refinance Equipment
- Cells(moduleStart + 21, 2).Value = "Used/Refinance Equipment"
- Range(Cells(moduleStart + 21, 20), Cells(moduleStart + 21, 32)).Merge
- Range(Cells(moduleStart + 21, 20), Cells(moduleStart + 21, 32)).BorderAround ColorIndex:=1, Weight:=xlThin
- 'Settlement
- Cells(moduleStart + 23, 2).Value = "Settlement"
- Range(Cells(moduleStart + 23, 20), Cells(moduleStart + 23, 32)).Merge
- Range(Cells(moduleStart + 23, 20), Cells(moduleStart + 23, 32)).BorderAround ColorIndex:=1, Weight:=xlThin
- 'Soft Costs
- Cells(moduleStart + 25, 2).Value = "Soft Costs"
- Range(Cells(moduleStart + 25, 20), Cells(moduleStart + 25, 32)).Merge
- Range(Cells(moduleStart + 25, 20), Cells(moduleStart + 25, 32)).BorderAround ColorIndex:=1, Weight:=xlThin
- 'Air
- Cells(moduleStart + 18, 34).Value = "% Air"
- 'New Equipment Rate
- Cells(moduleStart + 18, 40).Value = "Rate"
- Range(Cells(moduleStart + 19, 40), Cells(moduleStart + 19, 44)).Merge
- Range(Cells(moduleStart + 19, 40), Cells(moduleStart + 19, 44)).BorderAround ColorIndex:=1, Weight:=xlThin
- 'Used/Refinance Rate
- Range(Cells(moduleStart + 21, 40), Cells(moduleStart + 21, 44)).Merge
- Range(Cells(moduleStart + 21, 40), Cells(moduleStart + 21, 44)).BorderAround ColorIndex:=1, Weight:=xlThin
- 'Settlement Rate
- Range(Cells(moduleStart + 23, 40), Cells(moduleStart + 23, 44)).Merge
- Range(Cells(moduleStart + 23, 40), Cells(moduleStart + 23, 44)).BorderAround ColorIndex:=1, Weight:=xlThin
- ' % of Air
- Range(Cells(moduleStart + 23, 34), Cells(moduleStart + 23, 36)).Merge
- Range(Cells(moduleStart + 23, 34), Cells(moduleStart + 23, 36)).BorderAround ColorIndex:=1, Weight:=xlThin
- 'Soft Costs Rate
- Range(Cells(moduleStart + 25, 40), Cells(moduleStart + 25, 44)).Merge
- Range(Cells(moduleStart + 25, 40), Cells(moduleStart + 25, 44)).BorderAround ColorIndex:=1, Weight:=xlThin
- 'Lease Payment
- Cells(moduleStart + 18, 49).Value = "Lease Payment"
- 'New Eqp Lease Payment
- Range(Cells(moduleStart + 19, 49), Cells(moduleStart + 19, 56)).Merge
- Range(Cells(moduleStart + 19, 49), Cells(moduleStart + 19, 56)).BorderAround ColorIndex:=1, Weight:=xlThin
- 'Used / Refinanced EQP Lease payment
- Range(Cells(moduleStart + 21, 49), Cells(moduleStart + 21, 56)).Merge
- Range(Cells(moduleStart + 21, 49), Cells(moduleStart + 21, 56)).BorderAround ColorIndex:=1, Weight:=xlThin
- 'Settlement Lease Payment
- Range(Cells(moduleStart + 23, 49), Cells(moduleStart + 23, 56)).Merge
- Range(Cells(moduleStart + 23, 49), Cells(moduleStart + 23, 56)).BorderAround ColorIndex:=1, Weight:=xlThin
- 'Soft Costs Lease Payment
- Range(Cells(moduleStart + 25, 49), Cells(moduleStart + 25, 56)).Merge
- Range(Cells(moduleStart + 25, 49), Cells(moduleStart + 25, 56)).BorderAround ColorIndex:=1, Weight:=xlThin
- 'Rate Total
- Range(Cells(moduleStart + 31, 40), Cells(moduleStart + 31, 44)).Merge
- Range(Cells(moduleStart + 31, 40), Cells(moduleStart + 31, 44)).BorderAround ColorIndex:=1, Weight:=xlThin
- 'Lease Paymment
- Range(Cells(moduleStart + 31, 49), Cells(moduleStart + 31, 56)).Merge
- Range(Cells(moduleStart + 31, 49), Cells(moduleStart + 31, 56)).BorderAround ColorIndex:=1, Weight:=xlThin
- 'Total
- Cells(moduleStart + 27, 2).Value = "Total"
- Range(Cells(moduleStart + 27, 20), Cells(moduleStart + 27, 32)).Merge
- Range(Cells(moduleStart + 27, 20), Cells(moduleStart + 27, 32)).BorderAround ColorIndex:=1, Weight:=xlThin
- 'Total Amount Financed
- Cells(moduleStart + 31, 2).Value = "Total Amount Financed"
- Range(Cells(moduleStart + 31, 20), Cells(moduleStart + 31, 32)).Merge
- Range(Cells(moduleStart + 31, 20), Cells(moduleStart + 31, 32)).BorderAround ColorIndex:=1, Weight:=xlThin
- 'Misc
- Cells(moduleStart + 35, 58).Value = "*Please indicate any other pertinent information necessary"
- Cells(moduleStart + 35, 58).HorizontalAlignment = xlRight
- Range(Cells(moduleStart + 35, 1), Cells(moduleStart + 35, 58)).Interior.ColorIndex = 15
- Cells(moduleStart + 35, 1).Value = "E) Miscellaneous"
- Cells(moduleStart + 35, 1).Font.Bold = True
- Cells(moduleStart + 35, 2).HorizontalAlignment = xlLeft
- Range(Cells(moduleStart + 35, 1), Cells(moduleStart + 35, 58)).BorderAround ColorIndex:=1, Weight:=xlThin
- Rows(moduleStart + 36).RowHeight = 6.6
- 'Misc Section
- Range(Cells(moduleStart + 37, 1), Cells(moduleStart + 39, 58)).Merge
- Range(Cells(moduleStart + 37, 1), Cells(moduleStart + 39, 58)).BorderAround ColorIndex:=1, Weight:=xlThin
- Rows(moduleStart + 40).RowHeight = 6.6
- 'Footer thick side border
- With Worksheets(leaseSheet).Range(Cells(moduleStart - 1, 58), Cells(moduleStart + 40, 58)).Borders(xlEdgeRight)
- .LineStyle = xlContinuous
- .Weight = xlMedium
- End With
- With Worksheets(leaseSheet).Range(Cells(moduleStart + 40, 1), Cells(moduleStart + 40, 58)).Borders(xlEdgeBottom)
- .LineStyle = xlContinuous
- .Weight = xlMedium
- End With
- ' //////////////////////////////
- ' //Fill Movement Forms Script//
- ' //////////////////////////////
- currentWs = 16
- currentItem = 16
- lpmItem = 16
- standardSheetNumber = 16
- mySheets = Worksheets.Count
- firstProduct = 0
- lastProduct = 14
- StandardRowsPCList = 15
- StandardRowsInSheet = 15
- equipmentSheet = 2
- productListEnd = Sheets(2).Range("E16").End(xlDown).Row - StandardRowsPCList
- itemsInSheet = 0
- filledItems = 0
- lpmSheet = 7
- For i = standardSheetNumber To mySheets
- Sheets(currentWs).Activate
- itemsInSheet = Sheets(currentWs).Range("A16").End(xlDown).Row - StandardRowsInSheet
- For j = 0 To productListEnd - 1
- ProductCode = Sheets(equipmentSheet).Cells(currentItem + j, 5).Value
- productQty = Sheets(equipmentSheet).Cells(currentItem + j, 1).Value
- productCost = Sheets(equipmentSheet).Cells(currentItem + j, 10).Value
- For k = firstProduct To itemsInSheet
- If Sheets(currentWs).Cells(currentItem + k, 4).Value <> 1 Then
- pcToCheck = Sheets(currentWs).Cells(currentItem + k, 1).Value
- If pcToCheck = ProductCode Then
- Sheets(currentWs).Cells(currentItem + k, 6).Value = productCost
- Sheets(currentWs).Cells(currentItem + k, 4).Value = Sheets(currentWs).Cells(currentItem + k, 4).Value + 1
- Exit For
- End If
- End If
- Next k
- filledItems = WorksheetFunction.Sum(Sheets(currentWs).Range(Cells(16, 4), Cells(16 + itemsInSheet, 4)))
- If filledItems = itemsInSheet Then
- totalPrice = WorksheetFunction.Sum(Sheets(currentWs).Range(Cells(16, 6), Cells(16 + itemsInSheet, 6)))
- Sheets(lpmSheet).Cells(lpmItem, 15).Value = totalPrice
- lpmItem = lpmItem + 2
- Exit For
- End If
- Next j
- If currentWs < mySheets Then
- currentWs = currentWs + 1
- Else
- Sheets(lpmSheet).Activate
- End If
- Next i
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement