Guest User

Untitled

a guest
Oct 23rd, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. Sub LoopSelection()
  2.  
  3. Dim cel As Range
  4. Dim selectedRange As Range
  5. Dim aa As String
  6. Dim counter As Integer
  7. counter = 2
  8.  
  9. Set selectedRange = Application.Selection
  10.  
  11. For Each cel In selectedRange.Cells
  12. Debug.Print cel.Address
  13. If cel.Hyperlinks.Count > 0 Then
  14. aa = cel.Hyperlinks.Item(1).SubAddress
  15. If cel.Hyperlinks.Item(1).SubAddress Like "*!*" Then
  16. cel.Hyperlinks.Item(1).SubAddress = Trim(Split(aa, "!")(0)) & "!A" & counter
  17. End If
  18. counter = counter + 1
  19. Debug.Print cel.Hyperlinks.Item(1).SubAddress
  20. End If
  21. Next cel
  22.  
  23. $I$10 1
  24. CommLinkItem_57!A2
  25. $I$11 1
  26. CommLinkItem_57!A3
  27. $I$12 1
  28. CommLinkItem_57!A4
  29. $I$13 1
  30. CommLinkItem_57!A5
  31. $I$14 1
  32. CommLinkItem_57!A6
  33. $I$15 1
  34. CommLinkItem_57!A7
  35. $I$16 1
  36. CommLinkItem_57!A8
  37. $I$17 1
  38. CommLinkItem_57!A9
  39. $I$18 1
  40. CommLinkItem_57!A10
  41. $I$19 1
  42. CommLinkItem_57!A11
  43. $I$20 1
  44. CommLinkItem_57!A12
Add Comment
Please, Sign In to add comment