Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default autoshape color conditional formating

I'm trying to have an autoshape turn either red or green dependent upon the
value in two other separate cells.

Example: if A1 0 or if B1 0, the make the autoshape green
otherwise, make the autoshape red.

Is there any VBA code out that that I could paste to do this?

Thanks for any help you can give.
--
Dennis
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default autoshape color conditional formating

Sub Macro1()
ActiveSheet.Shapes("Oval 1").Select
If Range("A1").Value 0 Or Range("B1").Value 0 Then
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 17
Else
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 10
End If
End Sub
--
Gary''s Student - gsnu200786


"Dennis Collins" wrote:

I'm trying to have an autoshape turn either red or green dependent upon the
value in two other separate cells.

Example: if A1 0 or if B1 0, the make the autoshape green
otherwise, make the autoshape red.

Is there any VBA code out that that I could paste to do this?

Thanks for any help you can give.
--
Dennis

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default autoshape color conditional formating

Thanks for getting back to me.

I've tried the code, but it's not yet working. I'm not a VBA guy, but I
pasted the code into (General) and it's named Macro1. I've also assigned
the macro to the autoshape. I'm using A1 and B1 from the same sheet as the
autoshape, and the values in those cells are entered manually by me (not
formulas).

After pasting the code, I just 'saved' it. There must be something very
small that I'm missing, but I can't think of it. Is there anything else
special that I need to do to the autoshape?

Thanks again.
--
Dennis


"Gary''s Student" wrote:

Sub Macro1()
ActiveSheet.Shapes("Oval 1").Select
If Range("A1").Value 0 Or Range("B1").Value 0 Then
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 17
Else
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 10
End If
End Sub
--
Gary''s Student - gsnu200786


"Dennis Collins" wrote:

I'm trying to have an autoshape turn either red or green dependent upon the
value in two other separate cells.

Example: if A1 0 or if B1 0, the make the autoshape green
otherwise, make the autoshape red.

Is there any VBA code out that that I could paste to do this?

Thanks for any help you can give.
--
Dennis

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default autoshape color conditional formating

We are making progress:

A. Adaptation
1. The coding uses a shape called "Oval 1". Make sure you update to match
the name of your shape.

B. Installation
1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window


C. Usage
1. Don't assign the macro to the shape, it's designed to run manually:
2. ALT-F8
pick the macro
touch Run

If you want the macro to run automatically whenever A1 or B1 are manually
changed, update this post.
--
Gary''s Student - gsnu200786


"Dennis Collins" wrote:

Thanks for getting back to me.

I've tried the code, but it's not yet working. I'm not a VBA guy, but I
pasted the code into (General) and it's named Macro1. I've also assigned
the macro to the autoshape. I'm using A1 and B1 from the same sheet as the
autoshape, and the values in those cells are entered manually by me (not
formulas).

After pasting the code, I just 'saved' it. There must be something very
small that I'm missing, but I can't think of it. Is there anything else
special that I need to do to the autoshape?

Thanks again.
--
Dennis


"Gary''s Student" wrote:

Sub Macro1()
ActiveSheet.Shapes("Oval 1").Select
If Range("A1").Value 0 Or Range("B1").Value 0 Then
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 17
Else
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 10
End If
End Sub
--
Gary''s Student - gsnu200786


"Dennis Collins" wrote:

I'm trying to have an autoshape turn either red or green dependent upon the
value in two other separate cells.

Example: if A1 0 or if B1 0, the make the autoshape green
otherwise, make the autoshape red.

Is there any VBA code out that that I could paste to do this?

Thanks for any help you can give.
--
Dennis

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 6
Default autoshape color conditional formating

Hi. Yes, I'm seeing progress. I THINK I have it to the point where if I
manually run the macro, it works. You hit the nail on the head with your
last sentence in that I DO want it to update automatically whenever A1 or B2
are changed.

Is that doable?

Thanks much!


--
Dennis


"Gary''s Student" wrote:

We are making progress:

A. Adaptation
1. The coding uses a shape called "Oval 1". Make sure you update to match
the name of your shape.

B. Installation
1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window


C. Usage
1. Don't assign the macro to the shape, it's designed to run manually:
2. ALT-F8
pick the macro
touch Run

If you want the macro to run automatically whenever A1 or B1 are manually
changed, update this post.
--
Gary''s Student - gsnu200786


"Dennis Collins" wrote:

Thanks for getting back to me.

I've tried the code, but it's not yet working. I'm not a VBA guy, but I
pasted the code into (General) and it's named Macro1. I've also assigned
the macro to the autoshape. I'm using A1 and B1 from the same sheet as the
autoshape, and the values in those cells are entered manually by me (not
formulas).

After pasting the code, I just 'saved' it. There must be something very
small that I'm missing, but I can't think of it. Is there anything else
special that I need to do to the autoshape?

Thanks again.
--
Dennis


"Gary''s Student" wrote:

Sub Macro1()
ActiveSheet.Shapes("Oval 1").Select
If Range("A1").Value 0 Or Range("B1").Value 0 Then
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 17
Else
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 10
End If
End Sub
--
Gary''s Student - gsnu200786


"Dennis Collins" wrote:

I'm trying to have an autoshape turn either red or green dependent upon the
value in two other separate cells.

Example: if A1 0 or if B1 0, the make the autoshape green
otherwise, make the autoshape red.

Is there any VBA code out that that I could paste to do this?

Thanks for any help you can give.
--
Dennis



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default autoshape color conditional formating

1. delete the old macro
2. install the following event macro in the worksheet code area:

Private Sub Worksheet_Change(ByVal Target As Range)
Set r = Range("A1:B1")
If Intersect(Target, r) Is Nothing Then Exit Sub
Application.EnableEvents = False
ActiveSheet.Shapes("Oval 1").Select
If Range("A1").Value 0 Or Range("B1").Value 0 Then
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 17
Else
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 10
End If
ActiveCell.Select
Application.EnableEvents = True
End Sub


Because it is worksheet code, it is very easy to install and use:

1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window


To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm


--
Gary''s Student - gsnu200786


"Dennis Collins" wrote:

Hi. Yes, I'm seeing progress. I THINK I have it to the point where if I
manually run the macro, it works. You hit the nail on the head with your
last sentence in that I DO want it to update automatically whenever A1 or B2
are changed.

Is that doable?

Thanks much!


--
Dennis


"Gary''s Student" wrote:

We are making progress:

A. Adaptation
1. The coding uses a shape called "Oval 1". Make sure you update to match
the name of your shape.

B. Installation
1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window


C. Usage
1. Don't assign the macro to the shape, it's designed to run manually:
2. ALT-F8
pick the macro
touch Run

If you want the macro to run automatically whenever A1 or B1 are manually
changed, update this post.
--
Gary''s Student - gsnu200786


"Dennis Collins" wrote:

Thanks for getting back to me.

I've tried the code, but it's not yet working. I'm not a VBA guy, but I
pasted the code into (General) and it's named Macro1. I've also assigned
the macro to the autoshape. I'm using A1 and B1 from the same sheet as the
autoshape, and the values in those cells are entered manually by me (not
formulas).

After pasting the code, I just 'saved' it. There must be something very
small that I'm missing, but I can't think of it. Is there anything else
special that I need to do to the autoshape?

Thanks again.
--
Dennis


"Gary''s Student" wrote:

Sub Macro1()
ActiveSheet.Shapes("Oval 1").Select
If Range("A1").Value 0 Or Range("B1").Value 0 Then
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 17
Else
Selection.ShapeRange.Fill.ForeColor.SchemeColor = 10
End If
End Sub
--
Gary''s Student - gsnu200786


"Dennis Collins" wrote:

I'm trying to have an autoshape turn either red or green dependent upon the
value in two other separate cells.

Example: if A1 0 or if B1 0, the make the autoshape green
otherwise, make the autoshape red.

Is there any VBA code out that that I could paste to do this?

Thanks for any help you can give.
--
Dennis

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
Change color without conditional formating spacesyco Excel Discussion (Misc queries) 5 March 20th 07 10:42 PM
Applying conditional formating to make cells change color [email protected] Excel Discussion (Misc queries) 1 March 6th 07 10:51 PM
Conditional Formating Background Color tankerman Excel Discussion (Misc queries) 2 January 31st 07 02:02 PM
Conditional Formating - Different row color also when using filter Steen Excel Discussion (Misc queries) 5 January 3rd 07 10:56 PM
Conditional formating-change color of cells over than one with for carrera Excel Discussion (Misc queries) 4 November 28th 06 07:49 AM


All times are GMT +1. The time now is 12:35 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"