Advertisement
Kundepuu

Muotoilu

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