|
ネット上で探して利用しています
vba詳しくなくて教授お願いしたいのですが
現在のコードは左下から右上なのですが
これを左上から右下にコードを変更したいのですが
よろしくお願いします。単純な質問ですみません
Sub Add()
Dim Bx As Single, By As Single
Dim Ex As Single, Ey As Single
Dim RR As Range, MyObj As Object, Ch As Boolean
Ch = True
If TypeName(Selection) <> "Range" Then Exit Sub
Set RR = Selection
For Each MyObj In ActiveSheet.Lines
If MyObj.TopLeftCell.Row = RR.Row And _
MyObj.TopLeftCell.Column = RR.Column Then
MyObj.Delete
Ch = False
Exit For
End If
Next MyObj
If Ch Then
With RR
Bx = .Left
By = .Top + .Height
Ex = Bx + .Width
Ey = .Top
.Worksheet.Shapes.AddLine(Bx, By, Ex, Ey).Line.Weight = 0.5
End With
End If
Set RR = Nothing
End Sub
|
|