Då kör vi vidare.
Fortfarande i ”Designläget”, högerklicka på knappen och välj ”Visa kod”.

Då kommer Visual Basic Editorn upp. Den kan man också öppna manuellt med Alt+F11.

Skriv in "Call Update" som jag gjort i ovan skärmdump.
Dubbelklicka sedan på Module1 i det vänstra fönstret - jag har döpt om min modul till ”modMain” – då öppnas kodfönstret upp för den modulen.

Klistra in följande kod.
Sub Update()
Dim tS As ListObject
Dim tV As ListObject
Dim tSV As ListObject
Dim arr As Variant
Dim i As Integer
' Set Excel calculation mode to manual
Application.Calculation = xlCalculationManual
Set tS = Range("tS").ListObject
Set tV = Range("tV").ListObject
Set tSV = Range("tSV").ListObject
With tS.ListRows(1).Range
For i = 1 To 12
If .Cells(, i) = "" Then .Cells(, i) = "=fT"
Next i
End With
With tV.ListRows(1).Range
If .Cells(, 1) = "" Then .Cells(, 1) = "=fV"
End With
arr = Range("tV[Vikt]").ListObject.DataBodyRange
Range("tSV[Sorterad vikt]").ListObject.DataBodyRange = arr
tSV.Sort.SortFields.Clear
tSV.Sort.SortFields.Add Key:= _
Range("tSV[Sorterad vikt]"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _
xlSortNormal
With tSV.Sort
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
With tV.ListRows(1).Range
If .Cells(, 2) = "" Then .Cells(, 2) = "=fS"
End With
' Go "home"
Range("A1").Select
' Set Excel calculation mode to automatic
Application.Calculation = xlCalculationAutomatic
End Sub
Nu kan du stänga Visual Basic editorn, radera allt innehåll i samtliga tre tabeller, spara filen och testköra knappen.
Funkar allt som det ska har du nu ett fullt fungerande ”Stryktipssystem”.