Results 1 to 5 of 5

VBA AutoShape Color Change Script for Formula Cell

Threaded View

  1. #1
    Registered User
    Join Date
    05-29-2013
    Location
    London, England
    MS-Off Ver
    Excel 2003
    Posts
    10

    Unhappy VBA AutoShape Color Change Script for Formula Cell

    Hi, hope you guys can help - VBA virgin here...

    I'm employing the script below to change the fill color of 'FreeForm 9' autoshape based on the value in cell 'U117'.
    I understand that if cell 'U117' has a formula in it rather than a simple value, VBA will not use the resulting value.
    How can I replace the "U117" reference in the script and use the resulting value from a formula subtracting A1 - A2 instead?
    Thanks for any advice .

    Private Sub Worksheet_Change(ByVal Target As Range)

    If Not Intersect(Target, Range("U117")) Is Nothing Then
    If IsNumeric(Target.Value) Then
    If Target.Value > 0.4 Then
    ActiveSheet.Shapes("FreeForm 9").Fill.ForeColor.RGB = vbRed
    ElseIf Target.Value <= 0.4 And Target.Value > 0.05 Then
    ActiveSheet.Shapes("FreeForm 9").Fill.ForeColor.RGB = vbYellow
    ElseIf Target.Value <= 0.05 Then
    ActiveSheet.Shapes("FreeForm 9").Fill.ForeColor.RGB = vbGreen
    End If
    End If
    End If
    End Sub
    Last edited by Sean Ross; 05-29-2013 at 12:16 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1