|
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 4 Or Target.Column = 5 Then
Dim bf
k = 0
For Each pi In ActiveSheet.Shapes
If pi.Top = Target.Top Then
pi.Select
k = 1
Exit For
End If
Next
bf = Cells(Target.Row, 5) / Cells(Target.Row, 4)
If k = 0 Then
ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, Cells(Target.Row, 6).Left, Target.Top, Cells(Target.Row, 6).Width * bf, _
Cells(Target.Row, 6).Height).Select
Else
Selection.Width = Cells(Target.Row, 6).Width * bf
End If
Cells(Target.Row, 6) = Format(bf, "0.00%")
With Selection.ShapeRange.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 176, 240)
.Transparency = 0.8
.Solid
End With
With Selection.ShapeRange.TextFrame2
.VerticalAnchor = msoAnchorMiddle
.HorizontalAnchor = msoAnchorNone
.WordWrap = msoFalse
End With
End If
End Sub
|
评分
-
查看全部评分
|