Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default colour macro

I wonder if some can help\suggest, I'm creating a report and would like to
add shape to represent status. Is it possible to automate the shape to shorw
red, amber or green by clicking on it? Can I assign a dropdown to a shape or
do I need to write a macro and assign it to a shape? Please advise.
Afia
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default colour macro

Hi Alfa,

Try assignin the shapes to the following macro:

'=============
Public Sub Tester()
Dim SHP As Shape

Set SHP = ActiveSheet.Shapes(Application.Caller)

With SHP.Fill.ForeColor
Select Case .RGB
Case vbGreen: .RGB = vbYellow
Case vbYellow: .RGB = vbRed
Case Else: .RGB = vbGreen
End Select
End With
End Sub
'<<=============

Succesive clicks will cycle the shape's colour through
green, amber and red;

---
Regards,
Norman




"Afia" wrote in message
...
I wonder if some can help\suggest, I'm creating a report and would like to
add shape to represent status. Is it possible to automate the shape to
shorw
red, amber or green by clicking on it? Can I assign a dropdown to a shape
or
do I need to write a macro and assign it to a shape? Please advise.
Afia



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default colour macro

Thank you, it works and brilliant!!!
Can I make the shape to automate its fore colour as in the cell?
Say c4:w4 got conditional formatting for Red, amber and green and if I add
shape to each cell, can it be automated as the cell text?
--
Afia


"Norman Jones" wrote:

Hi Alfa,

Try assignin the shapes to the following macro:

'=============
Public Sub Tester()
Dim SHP As Shape

Set SHP = ActiveSheet.Shapes(Application.Caller)

With SHP.Fill.ForeColor
Select Case .RGB
Case vbGreen: .RGB = vbYellow
Case vbYellow: .RGB = vbRed
Case Else: .RGB = vbGreen
End Select
End With
End Sub
'<<=============

Succesive clicks will cycle the shape's colour through
green, amber and red;

---
Regards,
Norman




"Afia" wrote in message
...
I wonder if some can help\suggest, I'm creating a report and would like to
add shape to represent status. Is it possible to automate the shape to
shorw
red, amber or green by clicking on it? Can I assign a dropdown to a shape
or
do I need to write a macro and assign it to a shape? Please advise.
Afia




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default colour macro

Hi Afia,


Perhaps youcould utilise the shape's TopLeftCell property
to identify the cell of interest and you could use the same
conditions as used for the conditional formatting to determine
the shape's colour.

Perhaps, for example, try something like:

'=============
Public Sub Tester()
Dim SHP As Shape

Set SHP = ActiveSheet.Shapes(Application.Caller)

With SHP.Fill.ForeColor
Select Case SHP.TopLeftCell.Value
Case Is <= 10: .RGB = vbYellow
Case Is <= 50: .RGB = vbRed
Case Is <= 100: .RGB = vbGreen
Case Else: .RGB = vbMagenta
End Select
End With
End Sub
'<<=============


---
Regards,
Norman


"Afia" wrote in message
...
Thank you, it works and brilliant!!!
Can I make the shape to automate its fore colour as in the cell?
Say c4:w4 got conditional formatting for Red, amber and green and if I add
shape to each cell, can it be automated as the cell text?
--
Afia



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
macro for Tab colour change Mike Excel Discussion (Misc queries) 3 December 17th 09 12:45 AM
Colour macro LITTLE PETE Excel Discussion (Misc queries) 3 June 19th 08 12:51 AM
Change Tab colour using Macro Rajat Excel Worksheet Functions 4 October 24th 06 02:31 PM
Font Colour Macro Sukh Excel Programming 1 September 19th 06 09:39 AM
Colour Macro Ntisch Excel Programming 2 February 10th 04 10:08 AM


All times are GMT +1. The time now is 04:02 AM.

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

About Us

"It's about Microsoft Excel"