Guest User

Golfed Solution

a guest
Aug 16th, 2021
64
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'Proposed modification to https://codegolf.stackexchange.com/a/233314/61846
  2. 'must be put into a worksheet module
  3. 'All cells in the usedrange must hold a value; ie - spaces not blanks
  4. Sub g
  5. Set a=UsedRange
  6. m=a.Rows.Count
  7. n=a.Columns.Count
  8. r=1
  9. c=1
  10. Set u=[A1]
  11. Do
  12. Set x=Cells(r,c)
  13. Set u=Union(u,x)
  14. If InStr(1,"><v^",x)Then:s=(x="^")-(x="v"):d=(x="<")-(x=">")
  15. If x=";"Then Exit Do
  16. r=IIf(r+s<1,m,(r+s-1)Mod m+1)
  17. c=IIf(c+d<1,n,(c+d-1)Mod n+1)
  18. Loop
  19. For Each b In a
  20. If Intersect(b,u)Is Nothing Then b.Value=Chr(113*Rnd+14)
  21. Next
  22. End Sub
RAW Paste Data