18. maj 2020 - 12:27
Der er
5 kommentarer og
2 løsninger
Excel Visualisering
Hej
Jeg ønsker at visualiser nogen data.
Jeg vil gerne optegne en firkant, ud fra en højde og længde (eller x-y koordinator).
Ligeledes vil jeg gerne tegne en pil ind på samme visualisering, ud fra x-y koordinator.
Er det muligt?
Var ved at tænke på et x-y diagram, men kan ikke se hvordan man forbinder punkterne osv.
Prøv at erstatte den eksisterende makro med denne:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("C4:C7")) Is Nothing Then
Dim S, O, H, L, X, Y As Long
S = 60 'bestemmer tegningens størrelse
O = 50 'bestemmer position af øverste streg
H = Cells(4, 3)
L = Cells(5, 3)
X = Cells(6, 3)
Y = Cells(7, 3)
Dim Shp As Shape
For Each Shp In ActiveSheet.Shapes
If Shp.Type <> msoFormControl Then Shp.Delete
Next Shp
With Shapes.AddLine(300, O, 300 + L, O).Line
.Weight = 2
.ForeColor.RGB = RGB(50, 0, 128)
End With
With Shapes.AddLine(300, O, 300, H + O).Line
.Weight = 2
.ForeColor.RGB = RGB(50, 0, 128)
End With
With Shapes.AddLine(300 + L, O, 300 + L, H + O).Line
.Weight = 2
.ForeColor.RGB = RGB(50, 0, 128)
End With
With Shapes.AddLine(300, H + O, 300 + L, H + O).Line
.Weight = 2
.ForeColor.RGB = RGB(50, 0, 128)
End With
With Shapes.AddLine(300, O + H, 300 + X, O + H - Y).Line
.Weight = 2
.EndArrowheadStyle = msoArrowheadTriangle
.ForeColor.RGB = RGB(255, 0, 0)
End With
Shapes.AddTextbox(msoTextOrientationHorizontal, _
300 + X, O + H - Y, 90, 20) _
.TextFrame.Characters.Text = "x= " & X & ", Y= " & Y
ActiveCell.Select
End If
End Sub