Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. 'Comparing Entity, GREN and IC in order to compile the data for the entities
  2.  
  3. Dim entity_1, entity_2 As String
  4. Dim GREN_1, GREN_2 As String
  5. Dim IC_1, IC_2 As String
  6. Dim last_row_of_FC_OUTPUT, first As Integer
  7. Dim second As Integer
  8. Dim V_1 As Range
  9. Dim V_2 As Range
  10. Dim entity_comp, GREN_comp, IC_comp As Integer
  11.  
  12. Set V_1 = Application.Sheets("FC_OUPUT").Range("L1:CR1").Offset(first, 0)
  13. Set V_2 = Application.Sheets("FC_OUPUT").Range("L1:CR1").Offset(second, 0)
  14.  
  15.  
  16. first = 7 'First row with data
  17. second = 8 'Second row with data
  18.  
  19.  
  20. entity_1 = Application.Sheets("FC_OUTPUT").Range("D1").Offset(first, 0).Value
  21. entity_2 = Application.Sheets("FC_OUTPUT").Range("D1").Offset(second, 0).Value
  22.  
  23. GREN_1 = Application.Sheets("FC_OUTPUT").Range("H1").Offset(first, 0).Value
  24. GREN_2 = Application.Sheets("FC_OUTPUT").Range("H1").Offset(second, 0).Value
  25.  
  26. IC_1 = Application.Sheets("FC_OUTPUT").Range("I1").Offset(first, 0).Value
  27. IC_2 = Application.Sheets("FC_OUTPUT").Range("I1").Offset(second, 0).Value
  28.  
  29.  
  30. last_row_of_FC_OUTPUT = Range("Last_row_dump").Value + 1
  31.  
  32. entity_comp = StrComp(entity_1, entity_2, 1)
  33. GREN_comp = StrComp(GREN_1, GREN_2, 1)
  34. IC_comp = StrComp(IC_1, IC_2, 1)
  35.  
  36.  
  37. For first = 7 To last_row_of_FC_OUTPUT
  38.  
  39. Application.StatusBar = "Compiling rows " & first - 7
  40.  
  41. For second = first + 1 To last_row_of_FC_OUTPUT
  42. If entity_comp + GREN_comp + IC_comp = 0 Then
  43. V_1.Value = V_1.Value + V_2.Value
  44. Rows(second).Select.Delete
  45. End If
  46. Next second
  47. Next first
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement