Convert Excel Macro to Applescript to work with Numbers
I have an excel spreadsheet that uses macros. I am hoping to convert that spreadsheet to Numbers but I am not familiar with Applescript.
Is it possible to convert macros code to Applescript?
If so can anyone help convert the following codes:
1.
Sub Clear_Total_Plays()
' Create a loop to check each Total Play cell
' and reset their values to zero
Dim i As Integer
For i = 2 To 28
Cells(i, 9).Select
ActiveCell.Value = 0
Next i
Range("a1").Select
End Sub
2.
Sub Reset_Plays1()
' Reset_Plays1 Macro
' Resets Play Counter to zero.
Range("Table3[[#All],[Column2]]").Select
ActiveCell.FormulaR1C1 = "0"
Range("a1").Select
End Sub
3.
Sub Add_1_Play()
'
' Add_1_Play Macro
' Adds 1 Play to the Play counter.
'
'
' Create a loop to check each Total Play cell
' and increment their value by one if a player
' was in the current play
'Create an index to use in a for loop
Dim i As Integer
Dim j As Integer
'Create an array to store whether a player
'has had multiple plays in a row
Dim InARow(2 To 28) As Boolean
For i = 2 To 28
Cells(i, 9).Select
CurrentTotal = ActiveCell.Value
'If the boolean value is true
If Cells(i, 11) = True Then
'then increment the Total Plays by one
ActiveCell.Value = CurrentTotal + 1
InARow(i) = True
Else
'otherwise leave Total Plays alone
ActiveCell.Value = CurrentTotal
End If
Next i
For j = 2 To 28
Cells(j, 8).Select
'If player has played in the last play
If InARow(j) = True Then
'Increment the corresponding cell in the
'In a Row Column by 1
InARowValue = ActiveCell.Value
ActiveCell.Value = InARowValue + 1
Else
'Reset cell to zero and reset
'InARow boolean array index to false
Cells(j, 8).Select
ActiveCell.Value = 0
InARow(j) = False
End If
Next j
' Increment Total Plays by One
Range("Table3[[#All],[Column2]]").Select
PlayCount = ActiveCell.Value
ActiveCell.FormulaR1C1 = PlayCount + 1
Range("a1").Select
End Sub
Thank you
MacBook Pro (Retina, Mid 2012)