Show me that some sheets havent buttons but, YES have 1 button how to check?
Telefonos has 0 buttons:
General has 3 buttons:
Button 1 Attached macro = 'TELEFONOS DE PAGADORAS2.xlsm'!Botón1_Haga_clic_en
Button 2 Attached macro = 'TELEFONOS DE PAGADORAS2.xlsm'!Botón2_Haga_clic_en
Button 3 Attached macro = 'TELEFONOS DE PAGADORAS2.xlsm'!Botón3_Haga_clic_en
Rosario has 0 buttons:
Macetas has 0 buttons:
El Pino has 0 buttons:
La Finca has 0 buttons:
San Juanito has 0 buttons:
Chinacate has 0 buttons:
Tres Lagunas has 0 buttons:
Santa Rita has 0 buttons:
Huertas Locales has 0 buttons:
Los Patos has 0 buttons:
Cienega Barraganes has 0 buttons:
La Aurora has 0 buttons:
i checked and need pass the Sheet name as parameter because the button on each Sheet have this VBA code:
Private Sub Ejecutar_Click()
Dim i As Integer
Limpiar
i = 0
k = 1
j = 1
NumMesas = ActiveSheet.Cells(2, 3) 'Reng,Col
RangoMinimo = ActiveSheet.Cells(3, 3)
RangoMaximo = ActiveSheet.Cells(4, 3)
Diferencia = RangoMaximo - RangoMinimo + 150
Do While i < NumMesas
j = j + 1
Randomize
RandomNumber = Int((RangoMaximo - RangoMinimo + 1) * Rnd) + 6
If (RandomNumber >= RangoMinimo And RandomNumber <= RangoMaximo) Then
If Worksheets("Telefonos").Cells(RandomNumber, 6) <> "X" Then
ActiveSheet.Cells(k + 1, 6) = Worksheets("Telefonos").Cells(RandomNumber, 2)
Worksheets("Telefonos").Cells(RandomNumber, 6) = "X"
k = k + 1
i = i + 1
End If
End If
If j > Diferencia Then
Exit Do
End If
Loop
End Sub
then i need in this VBA code:
k = 2
For i = 1 To Sheets.Count
If Not (Sheets(i).Name = "General" Or Sheets(i).Name = "Telefonos" Or Sheets(i).Name = "Resumen") Then
Worksheets("General").Cells(k, 3) = Sheets(i).Name 'Renglon/Columna
Worksheets("General").Cells(k, 4) = Sheets(i).Cells(2, 3)
With Sheets(i)
Run .Buttons("Ejecutar").OnAction
End With
k = k + 1
End If
Next i
Run .Buttons("Ejecutar").OnAction
i need pass the Sheet name because, i use ActiveSheet.
see this image: View image: excel1
Thanks
Bookmarks