Tengo una hoja de Excel con un plan para un año. Usar semanas para las columnas y luego un indicador de color para las semanas en las que suceden "cosas".
Como esto:
Mi pregunta es: ¿Existe alguna forma (integrada o mediante complementos) de agregar información a esta celda de una manera más estructurada?
Estoy pensando tal vez un poco de forma con
- Nombre
- Descripción
- Presupuesto
- Yada yada
- foo
De esta manera podría mantener mi descripción general pero al mismo tiempo agregar más información a cada celda.
¿Alguien que sepa acerca de una manera de lograr esto?
Respuesta1
Terminé creando un formulario de usuario con algunos cuadros de texto y un botón para guardar los valores en la misma columna/fila en otra hoja llamada "Datos".
Algo como esto:
Dim xml As String
xml = xml + "<CellDetails>"
xml = xml + " <Budget>" + UserForm1.txtBudget.Text + "</Budget>"
xml = xml + " <Comments>" + UserForm1.txtComments.Text + "</Comments>"
xml = xml + " <StartDate>" + Format(MonthView1.Value, "yyyy-mm-dd") + "</StartDate>"
xml = xml + " <EndDate>" + Format(MonthView2.Value, "yyyy-mm-dd") + "</EndDate>"
xml = xml + "</CellDetails>"
ThisWorkbook.Sheets("Data").Range(Selection.Address).Value = xml
Luego, activo esto desde la Hoja usando un listado de eventos al hacer "clic derecho" en una celda y completo los controles del formulario con los valores.
Private Sub Workbook_SheetBeforeRightClick (ByVal Sh como objeto, ByVal Target como rango, Cancelar como booleano)
En caso de error Continuar siguiente
' Sólo activa esto si se presiona la tecla Ctrl. Si IsControlKeyDown() = True Entonces
If Not ThisWorkbook.Sheets("Data").Range(Selection.Address).Value = "" Then
Dim XDoc As MSXML2.DOMDocument
Set XDoc = CreateObject("MSXML2.DOMDocument")
XDoc.LoadXML (ThisWorkbook.Sheets("Data").Range(Selection.Address).Value)
' Setting the form values
UserForm1.txtBudget.Text = XDoc.SelectSingleNode("//CellDetails/Budget").Text
UserForm1.txtComments.Text = XDoc.SelectSingleNode("//CellDetails/Comments").Text
' Setting the dates
UserForm1.MonthView1.Value = CDate(XDoc.SelectSingleNode("//CellDetails/StartDate").Text)
UserForm1.lbStartDate = XDoc.SelectSingleNode("//CellDetails/StartDate").Text
UserForm1.MonthView2.Value = CDate(XDoc.SelectSingleNode("//CellDetails/EndDate").Text)
UserForm1.lbEndDate = XDoc.SelectSingleNode("//CellDetails/EndDate").Text
End If
UserForm1.Show
Cancel = True
End If
On Error GoTo 0
Subtítulo final