Advertisement
Kundepuu

Untitled

Apr 6th, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. Sub Muotoile()
  2. Dim Vika As Integer
  3. Vika = Range("A65536").End(xlUp).Row
  4. Columns("A:A").Insert Shift:=xlToRight
  5. Range("A1").FormulaR1C1 = "1"
  6. Range("A2").FormulaR1C1 = "2"
  7. Range("A1:A2").AutoFill Destination:=Range("A1:A" & Vika)
  8. Range("A1:A" & Vika).Copy Range("A" & Vika + 1)
  9. Columns("A:C").Select
  10. ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
  11. ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("A1:A20") _
  12. , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
  13. With ActiveWorkbook.Worksheets("Sheet1").Sort
  14. .SetRange Range("A1:C" & 2 * Vika)
  15. .Header = xlGuess
  16. .MatchCase = False
  17. .Orientation = xlTopToBottom
  18. .SortMethod = xlPinYin
  19. .Apply
  20. End With
  21. Columns("A:A").Delete
  22. Range("B1:B" & 2 * Vika).Cut Range("B2")
  23. Range("A1").Select
  24. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement