Arrow shape line colour depending on cell

tlc53

Active Member
Joined
Jul 26, 2018
Messages
399
Hi there,
I would like an arrow to show if cell H107 does not equal zero.
I'm not even sure if I'm going in the right direction with this VBA code. Can anyone help please?

Private Sub Worksheet_Change(ByVal Target As Range)
If Range("h107") = 0 Then
ActiveSheet.Shapes.Range(Array("Arrow")).Select
Selection.ShapeRange.LineColour.RGB = RGB(0, 0, 0)
End Sub

I was thinking I could have the arrow black if cell H107 does not equal 0 and white (so it can't be seen) if it does equal 0.

Thank you!
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Why not use this:
Set the color of the shape to the color you want.
Then we show or hide the shape.
Now this cell change must be done manually and not the result of a formula change.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Modified  8/9/2018  12:42:11 AM  EDT
If Range("h107") <> 0 Then
ActiveSheet.Shapes.Range(Array("Arrow")).Visible = True
Else
ActiveSheet.Shapes.Range(Array("Arrow")).Visible = False
End If
End Sub
 
Upvote 0
Puts an arrow in the cell to the right of the cell that changes.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("H107")) Is Nothing Then
    If Range("H107").Value > 0 Then
        With Range("I107")
            .Font.Name = "Calibri"    '<---- or whichever is your standard font
            .Value = ""
        End With
    Else
        With Range("I107")
            .Font.Name = "Wingdings 3"
            .Value = "a"    '<---- or a host of other Wingdings 3 possibilities
        End With

    End If
End If
End Sub

Wingdings 3 possible cell values: Z, a, b, c etc up to m or 3, 4, 5 or 6.
 
Upvote 0
Thank you Jolivanes! That is an interesting code. In this instance I need a real BIG arrow but I think I'll save your code for use somewhere else in the spreadsheet.
Thanks again! :)
 
Upvote 0

Forum statistics

Threads
1,213,504
Messages
6,114,020
Members
448,543
Latest member
MartinLarkin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top