ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Conditional line/arrow (https://www.excelbanter.com/excel-discussion-misc-queries/48908-conditional-line-arrow.html)

Ken G.

Conditional line/arrow
 
Is it possible to have a line or arrow drawn between two cells if the amount
entered in one cell exceeds a control value in another cell?

Dave Peterson

Kind of...

I compared A1 with D10. I put a line from the drawing toolbar between these two
cells.

With that line selected, I typed a new name for it in the name box.
I called it: LineA1_D10
(just to distinguish it)

Then I rightclicked on that worksheet tab and selected view code. I pasted this
into the code window:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("a1,d10")) Is Nothing Then Exit Sub

If Me.Range("a1").Value Me.Range("D10").Value Then
Me.Lines("lineA1_d10").Visible = True
Else
Me.Lines("LineA1_D10").Visible = False
End If
End Sub

And it worked fine if I changed the value in A1 or D10.

Ken G. wrote:

Is it possible to have a line or arrow drawn between two cells if the amount
entered in one cell exceeds a control value in another cell?


--

Dave Peterson


All times are GMT +1. The time now is 11:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com