Macro para validar y lanzar UserForm
Necesito validar un UserForm con SI y NO y cada uno tiene una funcionalidad diferente. Adjunto imagen con la explicación.
Favor su apoyo en corregir la macro mencionada.
Gracias.
Private Sub CommandButton1_Click() Application.ScreenUpdating = False Application.EnableEvents = False ActiveSheet.DisplayPageBreaks = False Set h = Sheets("Report") Set r = h.Columns("A") 'Ingreso datos a TextBox4 y ComboBox1 y los ingreso a las columnas H e I 'se ingresan siempre y cuando hayan valores en la columna B f = 2 Do Until h.Cells(f, 1) = "" If h.Cells(f, 2) = "" Then GoTo siguiente h.Cells(f, "H") = TextBox4 h.Cells(f, "I") = ComboBox1 num = WorksheetFunction.Max(h.Columns("J")) h.Cells(f, "K") = num siguiente: f = f + 1 Loop 'oculto el formulario y abro el Formulario 4 Unload Me UserForm4.Show Application.ScreenUpdating = True Application.EnableEvents = True ActiveSheet.DisplayPageBreaks = True Application.CutCopyMode = False End Sub Private Sub UserForm_Activate() Set h = Sheets("Datos") If h.AutoFilterMode Then h.AutoFilterMode = False For i = 2 To h.Range("H" & Rows.Count).End(xlUp).Row Call Agregar(ComboBox1, h.Cells(i, "H").value) Next i End Sub