Varias fechas en un Calendar. 11

Perseo: el verdadero titulo sería: ¿Se puede?
La teoría me dice que "podría ser", pero no sé por dónde empezar...
Necesitaría, reitero, si es posible, en un UserForm hacer lo siguiente: llenar tantos Labels como veces haga click en fechas diferentes del Calendario...
¿Me explico? Esto es: 1er.click, 22-May-08 al Label1; 2do.click, 24-May-08 al Label2; 3er. Click, 26-May-08 al Label3... Y así (estimado, 12 Labels) para, al hacer click en el Botón, me vuelque todos los labels a una hoja Excel...
Porque es un poco tedioso hacer 16 "abrir y cerrar" el Formulario...
Un abrazo desde Argentina

1 Respuesta

Respuesta
1
Este código, como puedes ver, está hecho para que los nombres de los objetos sean:
Label 1 a 12 para las 12 etiquetas
Calendar1 para el calendario
CommandButton1 para el botón
Te creas el formulario con las 12 etiquetas, las cuales deben de tener el mismo nombre en "nombre" y en "caption", el calendario con calendar11 y el botón como CommandButton1 y le copias el siguiente código al formulario:
Private Sub Calendar1_Click()
If Label1.Caption = "Label1" Then
Label1.Caption = Calendar1.Value
Else
If Label2.Caption = "Label2" Then
Label2.Caption = Calendar1.Value
Else
If Label3.Caption = "Label3" Then
Label3.Caption = Calendar1.Value
Else
If Label4.Caption = "Label4" Then
Label4.Caption = Calendar1.Value
Else
If Label5.Caption = "Label5" Then
Label5.Caption = Calendar1.Value
Else
If Label6.Caption = "Label6" Then
Label6.Caption = Calendar1.Value
Else
If Label7.Caption = "Label7" Then
Label7.Caption = Calendar1.Value
Else
If Label8.Caption = "Label8" Then
Label8.Caption = Calendar1.Value
Else
If Label9.Caption = "Label9" Then
Label9.Caption = Calendar1.Value
Else
If Label10.Caption = "Label10" Then
Label10.Caption = Calendar1.Value
Else
If Label11.Caption = "Label11" Then
Label11.Caption = Calendar1.Value
Else
If Label12.Caption = "Label12" Then
Label12.Caption = Calendar1.Value
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End Sub
Private Sub CommandButton1_Click()
Range("a1").Value = Label1.Caption
Range("a2").Value = Label2.Caption
Range("a3").Value = Label3.Caption
Range("a4").Value = Label4.Caption
Range("a5").Value = Label5.Caption
Range("a6").Value = Label6.Caption
Range("a7").Value = Label7.Caption
Range("a8").Value = Label8.Caption
Range("a9").Value = Label9.Caption
Range("a10").Value = Label10.Caption
Range("a11").Value = Label11.Caption
Range("a12").Value = Label12.Caption
End
End Sub
Evidentemente, yo he seleccionado los rangos del A1 al A12. Eso lo cambias como te parezca.

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas