RCONDADO
New Member
- Joined
- Nov 4, 2014
- Messages
- 13
- Office Version
- 365
- Platform
- Windows
Dear all,
I'm using a macro just to suffle a sequence of numbers and then assign that to a button (attached), as follow:
It's working properly, but now I need to include two rotines, as follow:
1. Include a counter to count how many times the button was pressed; and
2. Save the workbook everytime that the button was pressed.
Please, could you help me?
Thank you and regards!
R. Condado.
I'm using a macro just to suffle a sequence of numbers and then assign that to a button (attached), as follow:
VBA Code:
Sub Embaralha_seleção()
Dim numm()
numm = Range("A1:A100")
ct = UBound(numm, 2)
lt = UBound(numm, 1)
ReDim dex(1 To lt * ct)
n = 0
For h = 1 To ct
For v = 1 To lt
If numm(v, h) & " " <> " " Then
n = n + 1
dex(n) = numm(v, h)
numm(v, h) = ""
End If
Next
Next
t = 1
For h = 1 To ct
For v = 1 To lt
volta:
Randomize
vvv = Int((n * Rnd) + 1)
If dex(vvv) = "" And t <= n Then
GoTo volta
Else
t = t + 1
numm(v, h) = dex(vvv)
dex(vvv) = ""
End If
Next
Next
Range("A1:A100") = numm
End Sub
It's working properly, but now I need to include two rotines, as follow:
1. Include a counter to count how many times the button was pressed; and
2. Save the workbook everytime that the button was pressed.
Please, could you help me?
Thank you and regards!
R. Condado.