|
En el modulo de la hoja:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Hoja As Worksheet
On Error Resume Next
If Target.Address = "$A$1" Then
If [A1] = "" Or [A2] = "" Then
MsgBox "faltan parametros"
Exit Sub
End If
Set Hoja = ActiveSheet
Me.Shapes("Rectangulo").Delete
With Hoja.Shapes.AddShape(msoShapeRectangle, 220.5, 189#, [A1], [A2])
.Name = "Rectangulo"
End With
[A1].Select
Set Hoja = Nothing
Exit Sub
End If
If Target.Address = "$A$2" Then
If [A1] = "" Or [A2] = "" Then
MsgBox "faltan parametros"
Exit Sub
End If
Set Hoja = ActiveSheet
Me.Shapes("Rectangulo").Delete
With Hoja.Shapes.AddShape(msoShapeRectangle, 220.5, 189#, [A1], [A2])
.Name = "Rectangulo"
End With
[A2].Select
Set Hoja = Nothing
Exit Sub
End If
End Sub
Abraham
|