Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. Sub Rangeheaders_test()
  2.  
  3. Dim r As Long
  4. Dim endRow As Long
  5. Dim endCell As Range
  6. Dim headers As Range
  7.  
  8. With ActiveSheet
  9.  
  10. endRow = 500
  11. For r = 1 To endRow
  12.  
  13. If .Cells(r, "A").Value = "Period" Then
  14. Set endCell = .Rows(r).Find(What:="Agent Split", LookIn:=xlValues,_
  15. LookAt:=xlPart, After:=.Cells(r, "A"))
  16.  
  17. Set headers = .Range(.Cells(r, "A"), endCell)
  18. End If
  19. Next r
  20. End With
  21.  
  22. headers.Select
  23.  
  24. End Sub
  25.  
  26. With ActiveSheet
  27. endRow = 500
  28.  
  29. r = 1 To endRow
  30.  
  31. If .Cells(r, "A").Value = "Period" Then
  32. Set endCell = .Rows(r).Find(What:="Agent Split", LookIn:=xlValues,_
  33. LookAt:=xlPart, After:=.Cells(r, "A"))
  34.  
  35. Set headers = .Range(.Cells(r, "A"), endCell)
  36. End If
  37. End With
  38.  
  39. headers.Select
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement