Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'a simple, (and pretty inefficient, but easy) macro to flip the values in a horizontal or vertical range. Saves a lot of time when you just want to swap two values or flip a list.
- Sub flipRange()
- '
- ' flipRange Macro
- '
- '
- Dim i As Long
- Dim num As Long
- Dim newRange As Range
- Dim rng As Range
- Dim formulas() As String
- i = 1
- num = Selection.Cells.count
- ReDim formulas(1 To num)
- For Each rng In Selection
- formulas(i) = rng.Formula
- i = i + 1
- Next rng
- i = num
- For Each rng In Selection
- rng.Formula = formulas(i)
- i = i - 1
- Next rng
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement