Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
NG NG is offline
external usenet poster
 
Posts: 18
Default adding an autoshape to vba code

Hi,

I have the following formula. What it does is if i enter a value a happy
face changes colors depending on the value entered. Now i have another shape
(arrow) that i want to incorporate into this formula. THe shape would change
color and orient itself in a certain way depending on the previous cell. say:
A1=20, A2=9, what the arrow would do is show a green color and it would be
facing up. if A2=9 and A3 =40, I would like the arrow to show point down as
an increase and show it self as red. Can any one help me with this.

Formula:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim r As Excel.Range
Dim myShape As Excel.Shape

Set r = Me.Range("$B11:$B99")
If Target.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("$B$11:$B$99")) Is Nothing Then Exit Sub

Set myShape = Sheets("Chart MT").Shapes("AutoShape 4")

If Target.Value < 7 Then
myShape.Fill.ForeColor.RGB = RGB(0, 255, 0)
ElseIf Target.Value 12 Then
myShape.Fill.ForeColor.RGB = RGB(255, 0, 0)
Else
myShape.Fill.ForeColor.RGB = RGB(255, 255, 0)
End If
End Sub

Thanks,

NG
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding code to a macro Excel Helps Excel Worksheet Functions 2 January 23rd 08 06:15 PM
adding a phone area code that is not there Kelly Excel Discussion (Misc queries) 4 December 13th 06 12:15 AM
adding and subtracting using vb code ASU Excel Discussion (Misc queries) 2 October 7th 06 09:48 AM
Errors in VB Code since adding macro Susan Excel Discussion (Misc queries) 1 April 11th 06 08:42 PM
bar code help, adding asterix to reference R D S Excel Discussion (Misc queries) 1 January 17th 05 06:05 PM


All times are GMT +1. The time now is 08:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"