Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default conditional formatting to drawing objects.

I have a "line" drawing object drawn in some sketch. I want to change this line color to red if the cell value A1 ="R",and make the line color to green if A1="L".
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default conditional formatting to drawing objects.

You could use a Worksheet_Change event to change the line colour when
the value in cell A1 is changed. The following code goes into the
sheet's module (right-click the sheet tab, choose View Code, and paste
the code onto the module sheet, where the cursor is flashing).

In this example, the Line is named Line 2. To see the name of your line,
select the line, and look in the Name Box, at the left end of the
formula bar.

'==================================
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Target.Address = "$A$1" Then
If UCase(Target.Value) = "R" Then
ActiveSheet.Shapes("Line 2") _
.Line.ForeColor.SchemeColor = 10
Else
If UCase(Target.Value) = "L" Then
ActiveSheet.Shapes("Line 2") _
.Line.ForeColor.SchemeColor = 17
End If
End If
End If

End Sub
'===================================

borde wrote:
I have a "line" drawing object drawn in some sketch. I want to change this line color to red if the cell value A1 ="R",and make the line color to green if A1="L".



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

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
Conditional Formatting on a Drawing? Storm Excel Worksheet Functions 2 October 31st 07 04:38 PM
Excel Conditional formatting of objects krista Excel Discussion (Misc queries) 1 September 18th 07 06:26 PM
Conditional Formatting - Drawing Lines Between Sorted Groups Sam via OfficeKB.com Excel Discussion (Misc queries) 2 May 26th 06 03:02 PM
Cutting Drawing Objects LostNFound Excel Discussion (Misc queries) 3 August 12th 05 05:35 PM
Conditional Formatting Drawing Objects Jon Rathbun Excel Programming 1 July 31st 03 05:06 PM


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

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"