Buenas tardes estimados, tengo la siguiente macro donde quiero que al seleccionar el checkbox1 me ejecute el primer procedimiento de lo contario siga al siguiente procedimiento, pero me esta tomando el valor en la casilla de adicion del segundo procedimiento. Agradezco me puedan orientar gracias.
Sub Dedicion()
dim sh1, jh2, jh3, jh4, jh5, jh6 as Worksheet
If sh1.CheckBox1.Value = True Then
Set jh5 = Workbooks.Open("\\10.7.10.1\calidad\RegCalidad 2024\Molienda de Cemento y Empaque\Base datos Cementos producido 2024.xlsx", ReadOnly:=True)
Set jh6 = Sheets("MEZCLA ADICION")
jh6.Activate
jh6.Cells(4, "A").Select
JFila = ActiveCell.Row
For i = 371 To 736
JFila = jh6.Cells(JFila, "A").End(xlDown).Row
Next i
JFila = Cells(JFila, "K").End(xlUp).Row
Cal5 = jh6.Cells(JFila, "K")
Else
Set jh1 = Workbooks.Open("\\10.7.10.1\calidad\SEGUIMIENTO HORA-HORA\PREHOMO.xlsx", ReadOnly:=True)
Set jh2 = Sheets("CALIZA ADICIÓN CTO")
jh2.Activate
jh2.Cells(4, "A").Select
JFila = ActiveCell.Row
For i = 1 To 4
JFila = jh2.Cells(JFila, "A").End(xlDown).Row
Next i
JFila = Cells(JFila, "K").End(xlUp).Row
End If
If jh2.Cells(JFila, "K") < jh2.Cells(JFila - 1, "K") Then
Cal1 = jh2.Cells(JFila, "K")
Else
Cal1 = (jh2.Cells(JFila, "K") + jh2.Cells(JFila - 1, "K")) / 2
End If
Set jh3 = Workbooks.Open("\\10.7.10.1\calidad\RegCalidad 2024\Molienda de Cemento y Empaque\Base datos Cementos producido 2024.xlsx", ReadOnly:=True)
Set jh4 = Sheets("CALIZA ADICION")
For i = 371 To 736
If (Not (jh4.Cells(i, "K") = Empty)) And jh4.Cells(i, "A") = (fecha - 1) And jh4.Cells(i, "B") = "4" Then
Cal2 = jh4.Cells(i, "K")
Else
If Cal2 < 2 Or Cal2 > 59 Then
Cal2 = 60
End If
End If
Next i
Filacal = jh4.Cells(736, "K").End(xlUp).Row
Cal3 = jh4.Cells(Filacal, "K")
If Cal2 = 60 Then
Cal4 = Cal3
Else
Cal4 = Cal2
End If
jh4.Activate
ActiveWorkbook.Close
If Cal1 < Cal4 Then
Caliza = Cal1
Else
Caliza = Cal4
End If
sh1.Activate
sh1.Cells(1, "N") = Caliza
jh2.Activate
ActiveWorkbook.Close
Application.ScreenUpdating = True
End Sub
Buenas tardes estimados, tengo la siguiente macro donde quiero que al seleccionar el checkbox1 me ejecute el primer procedimiento de lo contario siga al siguiente procedimiento, pero me esta tomando el valor en la casilla de adicion del segundo procedimiento. Agradezco me puedan orientar gracias.
Cemento.xlsmUnavailable Cemento.zipUnavailable