Advertisement
Guest User

Untitled

a guest
Jun 13th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub LeasePriceModel_Button2_Click()
  2.  
  3. currentWorksheet = 16
  4. currentItem = 16
  5. standardSheetNumber = 15
  6. mySheets = Worksheets.Count
  7. firstProduct = 0
  8. lastProduct = 14
  9. StandardRowsPCList = 15
  10. equipmentSheet = 2
  11. productListEnd = Sheets(2).Range("E16").End(xlDown).Row - StandardRowsPCList
  12.  
  13.  
  14. For i = standardSheetNumber To mySheets
  15.    
  16.     For j = 0 To productListEnd
  17.    
  18.         ProductCode = Sheets(equipmentSheet).Cells(currentItem + j, 5).Value
  19.         productQty = Sheets(equipmentSheet).Cells(currentItem + j, 1).Value
  20.         productCost = Sheets(equipmentSheet).Cells(currentItem + j, 10).Value
  21.        
  22.        
  23.        
  24.         For k = firstProduct To lastProduct
  25.    
  26.             pcToCheck = Sheets(i).Cells(currentItem + k, 1).Value
  27.  
  28.             If pcToCheck = ProductCode Then
  29.                 Sheets(i).Cells(currentItem + k, 6).Value = productCost
  30.                 Sheets(i).Cells(currentItem + k, 4).Value = Sheets(i).Cells(currentItem + k, 4).Value + 1
  31.                 Exit For
  32.             End If
  33.        
  34.         Next k
  35.    
  36.     Next j
  37.    
  38.     currentWorksheet = currentWorksheet + 1
  39.    
  40. Next i
  41.  
  42.  
  43. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement