Guest User

Untitled

a guest
May 25th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. Public Function funcLastRow(shtTarget As Worksheet, Optional iColLimit As Integer = -1) As Long
  2.  
  3. If iColLimit = -1 Then
  4. iColLimit = 256
  5. End If
  6.  
  7. Dim rowMaxIndex As Long
  8. rowMaxIndex = 0
  9.  
  10. Dim ctrCols As Integer
  11. For ctrCols = 1 To iColLimit
  12. If shtTarget.Cells(1048576, ctrCols).End(xlUp).Row > rowMaxIndex Then
  13. rowMaxIndex = shtTarget.Cells(1048576, ctrCols).End(xlUp).Row
  14. End If
  15. Next ctrCols
  16.  
  17. funcLastRow = rowMaxIndex
  18.  
  19. End Function
  20.  
  21. Dim lLastRow As Long
  22. lLastRow = funcLastRow(Sheets(1))
  23.  
  24. A2 = INDEX(Sheet1!A:A,1+QUOTIENT(ROW()-ROW($A$2)+6,6))
  25.  
  26. B2 = VLOOKUP($A2,Sheet1!$A$2:$I$3000,COLUMNS($A$1:B$1),FALSE)
  27.  
  28. C2 = VLOOKUP($A2,Sheet1!$A$2:$I$3000,COLUMNS($A$1:C$1),FALSE)
  29.  
  30. D2 = VLOOKUP($A2,Sheet1!$A$2:$I$3000,COLUMNS($A$1:D$1),FALSE)
  31.  
  32. G2 = "" & IF(SUMPRODUCT(--(Sheet1!$A$1:$I$1=F2))>0,INDEX(Sheet1!$I$1:$I$3000,MATCH(A2,Sheet1!$A$1:$A$3000,0)),INDEX(Sheet2!$G$1:$G$3000,MATCH(A2,Sheet1!$A$1:$A$3000,0)))
Add Comment
Please, Sign In to add comment