|
Sub 固定範囲内斜線()
'
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim RR As Range, MySp As Shape, Ch As Boolean
ActiveSheet.Unprotect
Ch = True
Set RR = Range("B13:F17")
For Each MySp In ActiveSheet.Shapes
If Not MySp.Type = msoFormControl Then ’分岐点追加
If MySp.TopLeftCell.Row = RR.Row And _
MySp.TopLeftCell.Column = RR.Column Then 'エラーはここです
MySp.Delete
Ch = False
Exit For
End If
End If
Next MySp
If Ch Then
With ActiveSheet.Shapes.AddLine(Range("B13").Left, Range("B13").Top, _
Range("F17").Left + Range("F17").Width, _
Range("F17").Top + Range("F17").Height)
.Flip msoFlipHorizontal
End With
End If
Set RR = Nothing
End Sub
こんな案しか思い浮かびません
|
|