Nota:
El acceso a esta página requiere autorización. Puede intentar iniciar sesión o cambiar directorios.
El acceso a esta página requiere autorización. Puede intentar cambiar los directorios.
Devuelve una matriz de celdas de ShapeSheet de las que depende la fórmula de otra celda. Solo lectura.
Sintaxis
más sencilla.Precedentes
expresión Variable que representa un objeto Cell .
Valor devuelto
Celda()
Comentarios
La propiedad Precedentes devuelve una matriz de las celdas que hacen que el objeto de celda principal vuelva a calcular su valor cuando cambia su fórmula o valor.
Ejemplo
La siguiente macro de Microsoft Visual Basic para Aplicaciones (VBA) muestra cómo usar la propiedad Precedentes para mostrar una lista de celdas de las que depende la celda "Scratch.X1" de una forma. La macro dibuja un rectángulo en la página activa, agrega una sección Borrador a la ShapeSheet del rectángulo y, después, escribe una fórmula en una celda de esa sección que se usa para arquear los lados del rectángulo hacia adentro, cambiando cada uno de los lados de los rectángulos a un arco. Debido a que la fórmula utilizada para arquear los lados del rectángulo depende del ancho y alto del rectángulo, la celda que contiene la fórmula, Scratch.X1, depende de las celdas de ancho y alto de la forma del rectángulo, lo que hace que estas celdas sean precedentes.
Public Sub Precedents_Example()
Dim acellPrecedentCells() As Visio.Cell
Dim vsoCell As Visio.Cell
Dim vsoShape As Visio.Shape
Dim strBowCell As String
Dim strBowFormula As String
Dim intCounter As Integer
'Set the value of the strBowCell string
strBowCell = "Scratch.X1"
'Set the value of the strBowFormula string
strBowFormula = "=Min(Width, Height) / 5"
'Draw a rectangle on the active page
Set vsoShape = ActivePage.DrawRectangle(1, 5, 5, 1)
'Add a scratch section and then
vsoShape.AddSection visSectionScratch
'Add a row to the scratch section
vsoShape.AddRow visSectionScratch, visRowScratch, 0
'Place the value of strBowFormula into Scratch.X1
'Set the Cell object to the Scratch.X1 and set formula
Set vsoCell = vsoShape.Cells(strBowCell)
'Set up the offset for the arc
vsoCell.Formula = strBowFormula
'Bow in or curve the original rectangle's lines by changing
'each row to an arc and entering the bow value
For intCounter = 1 To 4
vsoShape.RowType(visSectionFirstComponent, visRowVertex + intCounter) = visTagArcTo
Set vsoCell = vsoShape.CellsSRC(visSectionFirstComponent, visRowVertex + intCounter, 2)
vsoCell.Formula = "-" & strBowCell
Next intCounter
'Get the array of precedent cells
acellPrecedentCells = vsoShape.Cells("Scratch.X1").Precedents
'List the cell names and their associated formula
For intCounter = LBound(acellPrecedentCells) To UBound(acellPrecedentCells)
Set vsoCell = acellPrecedentCells(intCounter)
Debug.Print vsoCell.Name & " has this formula: " & vsoCell.Formula
Next
End Sub
Soporte técnico y comentarios
¿Tiene preguntas o comentarios sobre VBA para Office o esta documentación? Vea Soporte técnico y comentarios sobre VBA para Office para obtener ayuda sobre las formas en las que puede recibir soporte técnico y enviar comentarios.