Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. If Sheets(2).Cells(j, oppStatLoc).Value = OppStat Then
  2.  
  3. Function getOppStat(OppStat As String)
  4. 'For testing Purposes
  5. Dim paramList
  6. Dim lastRow As Long, lastCol As Long, currentRow As Long, oppStatLoc As Long
  7.  
  8. lastRow = Sheets("Parameter").Range("A65536").End(xlUp).Row
  9. lastCol = Sheets("Parameter").Range("XFD3").End(xlToLeft).Column
  10. currentRow = 2 'Sheets("OppStat").Range("A65536").End(xlUp).Row + 1
  11.  
  12. 'Set Up Headerz
  13. For i = 1 To lastCol
  14. Sheets("Parameter").Cells(3, i).Copy _
  15. Destination:=Sheets("OppStat").Cells(1, i)
  16. Next i
  17.  
  18. 'Look for OppStat Column
  19. For i = 1 To lastCol
  20. If Sheets("Parameter").Cells(3, i).Value = "Opportunity Status" Then
  21. oppStatLoc = i
  22. End If
  23. Next i
  24.  
  25. 'Set Up Valuez
  26. For j = 4 To lastRow
  27. If Sheets(2).Cells(j, oppStatLoc).Value = OppStat Then
  28. For k = 1 To lastCol
  29. Sheets(2).Cells(j, k).Copy _
  30. Destination:=Sheets(3).Cells(currentRow, k)
  31. Next k
  32. currentRow = currentRow + 1
  33. End If
  34.  
  35. Next j
  36.  
  37. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement