Advertisement
Guest User

Untitled

a guest
Apr 26th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Dim mySheets As Long
  2. Dim myActiveSheet As String
  3. Dim standardSheetNumber As Long
  4. Dim moduleStart As Long
  5.  
  6. Dim accountDetails As String
  7. Dim accountNumber As Long
  8. Dim Model As String
  9. Dim CompanyName As String
  10. Dim Address As String
  11. Dim City As String
  12. Dim State As String
  13. Dim ZipCode As String
  14. Dim fiancialInfo As String
  15. Dim leaseTerm As Long
  16.  
  17. moduleStart = 12
  18. standardSheetNumber = 19
  19. mySheets = Worksheets.Count - 3
  20.  
  21. 'Get account details
  22. accountDetails = Sheets(1).Name
  23. accountNumber = Sheets(accountDetails).Cells(17, 2).Value
  24.  
  25. 'Create Layout
  26. For i = standardSheetNumber To mySheets
  27.  
  28. Range(Cells(moduleStart + 1, 9), Cells(moduleStart + 20, 9)).Borders(xlEdgeRight).LineStyle = xlContinuous
  29.  
  30. Cells(moduleStart + 2, 1).Value = "Contract Type: CPC"
  31. Range(Cells(moduleStart + 2, 1), Cells(moduleStart + 2, 9)).Merge
  32. Range(Cells(moduleStart + 2, 1), Cells(moduleStart + 2, 9)).Font.Bold = True
  33.  
  34.  
  35. Cells(moduleStart + 3, 1).Value = "Model"
  36. Range(Cells(moduleStart + 3, 1), Cells(moduleStart + 3, 3)).Merge
  37. Range(Cells(moduleStart + 3, 1), Cells(moduleStart + 3, 3)).Font.Bold = True
  38.  
  39. Cells(moduleStart + 5, 1).Value = "Additional Fixed Charge"
  40. Range(Cells(moduleStart + 5, 1), Cells(moduleStart + 5, 3)).Merge
  41. Range(Cells(moduleStart + 5, 1), Cells(moduleStart + 5, 3)).Font.Bold = True
  42.  
  43. Cells(moduleStart + 6, 1).Value = "NO"
  44. Cells(moduleStart + 7, 1).Value = "Fixed Charge Description (if applicable):"
  45. Range(Cells(moduleStart + 7, 1), Cells(moduleStart + 7, 9)).Merge
  46.  
  47. Cells(moduleStart + 9, 1).Value = "Blk"
  48. Range(Cells(moduleStart + 5, 1), Cells(moduleStart + 5, 3)).Font.Bold = True
  49. Range(Cells(moduleStart + 8, 1), Cells(moduleStart + 10, 9)).Borders.LineStyle = xlContinuous
  50.  
  51. Cells(moduleStart + 10, 1).Value = "Clr"
  52. Cells(moduleStart + 12, 1).Value = "SHIP TO:"
  53. Range(Cells(moduleStart + 12, 1), Cells(moduleStart + 12, 9)).Merge
  54. Cells(moduleStart + 12, 1).Font.Bold = True
  55.  
  56. Cells(moduleStart + 13, 1).Value = "Account #:"
  57. Cells(moduleStart + 14, 1).Value = "Name"
  58. Cells(moduleStart + 15, 1).Value = "Address"
  59.  
  60. Cells(moduleStart + 19, 1).Value = "Special Provisions:"
  61. Range(Cells(moduleStart + 19, 1), Cells(moduleStart + 20, 8)).Merge
  62. Range(Cells(moduleStart + 19, 1), Cells(moduleStart + 20, 8)).VerticalAlignment = xlVAlignTop
  63. Range(Cells(moduleStart + 19, 1), Cells(moduleStart + 20, 8)).Borders.LineStyle = xlContinuous
  64.  
  65. Cells(moduleStart + 6, 2).Value = "YES"
  66. Cells(moduleStart + 8, 2).Value = "Image Charge"
  67. Range(Cells(moduleStart + 8, 2), Cells(moduleStart + 8, 9)).Font.Bold = True
  68. Range(Cells(moduleStart + 8, 2), Cells(moduleStart + 8, 4)).HorizontalAlignment = xlCenter
  69. Range(Cells(moduleStart + 8, 2), Cells(moduleStart + 8, 4)).Merge
  70.  
  71. Cells(moduleStart + 9, 2).Value = 0
  72. Range(Cells(moduleStart + 9, 2), Cells(moduleStart + 9, 4)).HorizontalAlignment = xlCenter
  73. Range(Cells(moduleStart + 9, 2), Cells(moduleStart + 9, 4)).Merge
  74.  
  75. Cells(moduleStart + 10, 2).Value = 0
  76. Range(Cells(moduleStart + 10, 2), Cells(moduleStart + 10, 4)).HorizontalAlignment = xlCenter
  77. Range(Cells(moduleStart + 10, 2), Cells(moduleStart + 10, 4)).Merge
  78.  
  79. Cells(moduleStart + 3, 4).Value = "Serial#"
  80. Range(Cells(moduleStart + 4, 4), Cells(moduleStart + 4, 5)).Interior.ColorIndex = 6
  81. Range(Cells(moduleStart + 3, 4), Cells(moduleStart + 3, 5)).Merge
  82. Range(Cells(moduleStart + 3, 4), Cells(moduleStart + 3, 9)).Font.Bold = True
  83.  
  84. Cells(moduleStart + 5, 4).Value = "Fix Change Amount"
  85. Range(Cells(moduleStart + 5, 4), Cells(moduleStart + 5, 9)).Font.Bold = True
  86. Range(Cells(moduleStart + 6, 4), Cells(moduleStart + 6, 5)).Merge
  87. Range(Cells(moduleStart + 6, 4), Cells(moduleStart + 6, 8)).Interior.ColorIndex = 6
  88.  
  89. Cells(moduleStart + 8, 5).Value = "Agreed Volume"
  90. Range(Cells(moduleStart + 8, 5), Cells(moduleStart + 8, 5)).HorizontalAlignment = xlCenter
  91. Range(Cells(moduleStart + 8, 5), Cells(moduleStart + 8, 7)).Merge
  92.  
  93. Cells(moduleStart + 9, 5).Value = 0
  94. Range(Cells(moduleStart + 9, 5), Cells(moduleStart + 9, 7)).HorizontalAlignment = xlCenter
  95. Range(Cells(moduleStart + 9, 5), Cells(moduleStart + 9, 7)).Merge
  96.  
  97. Cells(moduleStart + 10, 5).Value = 0
  98. Range(Cells(moduleStart + 10, 5), Cells(moduleStart + 10, 5)).HorizontalAlignment = xlCenter
  99. Range(Cells(moduleStart + 10, 5), Cells(moduleStart + 10, 7)).Merge
  100.  
  101. Cells(moduleStart + 3, 6).Value = "Installed Date"
  102. Range(Cells(moduleStart + 3, 6), Cells(moduleStart + 3, 8)).Merge
  103. Range(Cells(moduleStart + 4, 6), Cells(moduleStart + 4, 8)).Merge
  104.  
  105. Cells(moduleStart + 5, 6).Value = "Billing Frequency"
  106. Range(Cells(moduleStart + 5, 6), Cells(moduleStart + 5, 8)).Merge
  107. Range(Cells(moduleStart + 6, 6), Cells(moduleStart + 6, 8)).Merge
  108.  
  109. Cells(moduleStart + 13, 6).Value = "Meter Read:"
  110. Range(Cells(moduleStart + 13, 7), Cells(moduleStart + 13, 9)).Merge
  111. Range(Cells(moduleStart + 13, 7), Cells(moduleStart + 13, 9)).Borders(xlEdgeBottom).LineStyle = xlDash
  112. Range(Cells(moduleStart + 13, 7), Cells(moduleStart + 13, 8)).Interior.ColorIndex = 6
  113.  
  114. Cells(moduleStart + 14, 6).Value = "Phone #:"
  115. Range(Cells(moduleStart + 14, 7), Cells(moduleStart + 14, 9)).Merge
  116. Range(Cells(moduleStart + 14, 7), Cells(moduleStart + 14, 9)).Borders(xlEdgeBottom).LineStyle = xlDash
  117.  
  118. Cells(moduleStart + 15, 6).Value = "Fax #:"
  119. Range(Cells(moduleStart + 15, 7), Cells(moduleStart + 15, 9)).Merge
  120. Range(Cells(moduleStart + 15, 7), Cells(moduleStart + 15, 9)).Borders(xlEdgeBottom).LineStyle = xlDash
  121.  
  122. Cells(moduleStart + 16, 6).Value = "Email:"
  123. Range(Cells(moduleStart + 16, 7), Cells(moduleStart + 16, 9)).Merge
  124. Range(Cells(moduleStart + 16, 7), Cells(moduleStart + 16, 9)).Borders(xlEdgeBottom).LineStyle = xlDash
  125.  
  126. 'Cells at bottom of Module
  127. Range(Cells(moduleStart + 17, 7), Cells(moduleStart + 17, 9)).Merge
  128. Range(Cells(moduleStart + 18, 1), Cells(moduleStart + 18, 9)).Merge
  129.  
  130. Cells(moduleStart + 14, 7).Value = 0
  131. Cells(moduleStart + 15, 7).Value = 0
  132. Cells(moduleStart + 15, 7).Value = 0
  133.  
  134. Cells(moduleStart + 8, 8).Value = "Meter Start"
  135. Range(Cells(moduleStart + 8, 8), Cells(moduleStart + 8, 8)).HorizontalAlignment = xlCenter
  136. Range(Cells(moduleStart + 8, 8), Cells(moduleStart + 8, 9)).Merge
  137.  
  138. 'under meter start
  139. Range(Cells(moduleStart + 9, 8), Cells(moduleStart + 9, 8)).HorizontalAlignment = xlCenter
  140. Range(Cells(moduleStart + 9, 8), Cells(moduleStart + 9, 9)).Merge
  141.  
  142. 'second cell under meter start
  143. Range(Cells(moduleStart + 10, 8), Cells(moduleStart + 10, 8)).HorizontalAlignment = xlCenter
  144. Range(Cells(moduleStart + 10, 8), Cells(moduleStart + 10, 9)).Merge
  145.  
  146. Cells(moduleStart + 3, 9).Value = "Service Fee"
  147.  
  148. Cells(moduleStart + 4, 9).Interior.ColorIndex = 6
  149.  
  150. Cells(moduleStart + 5, 9).Value = "Initial Period (Mths)"
  151.  
  152. Cells(moduleStart + 6, 9).HorizontalAlignment = xlLeft
  153.  
  154. 'line break the customer and initial
  155. Cells(moduleStart + 19, 9).Value = "Customer " & Chr(10) & "Initial:"
  156. Range(Cells(moduleStart + 19, 9), Cells(moduleStart + 20, 9)).Merge
  157. Range(Cells(moduleStart + 19, 9), Cells(moduleStart + 20, 9)).Borders.LineStyle = xlContinuous
  158.  
  159.  
  160.     'Get Sheet name
  161.    myActiveSheet = Sheets(i).Name
  162.  
  163.     'Get Model
  164.    Range(Cells(moduleStart + 4, 1), Cells(moduleStart + 4, 3)).Merge
  165.     Model = Sheets(myActiveSheet).Cells(16, 2).Value
  166.     Cells(moduleStart + 4, 1).Value = Model
  167.    
  168.     'insert Account number
  169.    Range(Cells(moduleStart + 13, 2), Cells(moduleStart + 13, 5)).Merge
  170.     Range(Cells(moduleStart + 13, 2), Cells(moduleStart + 13, 5)).Borders(xlEdgeBottom).LineStyle = xlDash
  171.     Cells(moduleStart + 13, 2).Value = accountNumber
  172.     Cells(moduleStart + 13, 2).HorizontalAlignment = xlLeft
  173.    
  174.     'Get CompanyName from sheet
  175.    Range(Cells(moduleStart + 14, 2), Cells(moduleStart + 14, 5)).Merge
  176.     Range(Cells(moduleStart + 14, 2), Cells(moduleStart + 14, 5)).Borders(xlEdgeBottom).LineStyle = xlDash
  177.     CompanyName = Sheets(myActiveSheet).Cells(7, 2).Value
  178.     Cells(moduleStart + 14, 2).Value = CompanyName
  179.    
  180.     'Get Address from sheet
  181.    Range(Cells(moduleStart + 15, 2), Cells(moduleStart + 15, 5)).Merge
  182.     Range(Cells(moduleStart + 15, 2), Cells(moduleStart + 15, 5)).Borders(xlEdgeBottom).LineStyle = xlDash
  183.     Address = Sheets(myActiveSheet).Cells(8, 2).Value
  184.     Cells(moduleStart + 15, 2).Value = Address
  185.    
  186.     'Get City from sheet
  187.    Range(Cells(moduleStart + 16, 2), Cells(moduleStart + 16, 5)).Merge
  188.     Range(Cells(moduleStart + 16, 2), Cells(moduleStart + 16, 5)).Borders(xlEdgeBottom).LineStyle = xlDash
  189.     City = Sheets(myActiveSheet).Cells(9, 2).Value
  190.     Cells(moduleStart + 16, 2).Value = City
  191.    
  192.     'Get State from sheet
  193.    State = Sheets(myActiveSheet).Cells(10, 2).Value
  194.    
  195.     'Get ZipCode from sheet
  196.    Range(Cells(moduleStart + 17, 2), Cells(moduleStart + 17, 5)).Merge
  197.     Range(Cells(moduleStart + 17, 2), Cells(moduleStart + 17, 5)).Borders(xlEdgeBottom).LineStyle = xlDash
  198.     ZipCode = Sheets(myActiveSheet).Cells(11, 2).Value
  199.     Cells(moduleStart + 17, 2).Value = State & " - " & ZipCode
  200.    
  201.     'Get Lease Term
  202.    leaseTerm = Sheets(3).Cells(15, 4).Value
  203.     Cells(moduleStart + 6, 9).Value = leaseTerm
  204.    
  205.     moduleStart = moduleStart + 20
  206.  
  207. Next i
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement