Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/01/2013, 09:01
Avatar de Pasote
Pasote
 
Fecha de Ingreso: mayo-2006
Ubicación: España - Islas Canarias
Mensajes: 389
Antigüedad: 18 años
Puntos: 3
Mejorar código checklist macro vba

Tengo un código que me gustaría ampliar.
permite crear hojas de chequeo.
La inicial tiene un número de topics y de itemes por topic
Me gustaría que se pudieran aumentar el número de topic's, y que el número de item's por topic pudiera ser distinto.

El código inicial es :

Código:
Option Explicit

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
' Manage double clicking on the worksheet (used for changing the status of a check item or an entire topic)
Dim blnIsTopic As Boolean

    On Error Resume Next
    
    ' User double clicked outside the checklist area - > exit sub
    If Application.Intersect(ActiveCell, Range("myCheckList")) = False Then Exit Sub

    ' Set boolean variable: true, if user double clicked on a topic (header)
    blnIsTopic = (InStr(ActiveCell.Offset(0, -(ActiveCell.Column - Range("myCheckList").Column)), C_SEPARATOR) = 0) And _
                 (ActiveCell.Offset(0, -(ActiveCell.Column - Range("myCheckList").Column)).Value <> "")
              
    If ActiveCell.Column = Range("myCheckList").Column + Range("myCheckList").Columns.Count - 1 Then
    ' User double clicked on a cell in the status column
        
        If ActiveCell.Value = C_DONE Then
        ' If status = done: status will be set to open
            ActiveCell.Value = C_OPEN
        ElseIf ActiveCell.Value = C_OPEN Or ActiveCell.Value = C_MIXED Then
        ' If status = open or mixed (topics only): status will be set to done
            ActiveCell.Value = C_DONE
        End If
        
        If blnIsTopic Then
            Call ChangeTopicStatus
        Else
            Call AutomaticSetTopicStatus
        End If
    
    ElseIf blnIsTopic Then
    ' User double clicked in a topic row and not on the status column -> expand or collapse the items of this topic
        Call ExpandCollapseItems
    End If

End Sub
Gracias