LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Add Borders based on ByVal Target As Range

Marty,
Using the formula options in conditional formatting you can format a cell
based on a different cells value.

In H229
you would add this condition
Formula is
=$F$229 = "Yes"
then add your format.

In J229
you would add this condition
Formula is
=$F$229 = "Yes"
then add your format.

This would accomplish the same results without vba coding.

Thought I would let you know, your choice of course.

HTH
Cal


"Marty" wrote:

"Border Around" worked like a charm. Thanks for that.

"Gary Keramidas" wrote:

not sure if this will help or not. maybe you have some other formatting commands
somewhere

Range("F229").BorderAround ColorIndex:=1, Weight:=xlThin

--


Gary


"Marty" wrote in message
...
Greetings:

I have a Yes/No pulldown menu in cell F229. My spreadsheet has a white
background (color index 0).

If "Yes" is selected, I want some text to appear in Cell H229 (the text is
currently there, I just want to change it to font color index 0 so that it
will be visible), and I want to turn the background of cell J229 yellow and
put a border around it.

If F229 is selected as "No" or is blank, I want the text in H229 to go
invisible (not delete) and reset the yellow bordered cell back to white
background with no borders.

I recorded and modified a macro. Here is the relevant code (declarations
not included):

If Target.Cells(1).Address = "$F$229" Then
'Make text in H229 bordered box with yellow background appear if "Yes" in F229
Application.EnableEvents = False
If MM.Range("F229") = "Yes" Then
Range("H229").Font.ColorIndex = 0 'OK
Range("J229").Interior.ColorIndex = 6 'OK
Range("J229").Borders(xlEdgeLeft).ColorIndex = xlAutomatic 'OK
Range("J229").Borders(xlEdgeTop).ColorIndex = xlAutomatic 'Not
executing
Range("J229").Borders(xlEdgeBottom).ColorIndex = xlAutomatic 'Not
executing
Range("J229").Borders(xlEdgeRight).ColorIndex = xlAutomatic 'Not
executing
Else
Range("H229").Font.ColorIndex = 2 'OK
Range("J229").Interior.ColorIndex = 0 'OK
Range("J229").Borders(xlEdgeLeft).LineStyle = xlNone 'OK
Range("J229").Borders(xlEdgeTop).LineStyle = xlNone 'OK
Range("J229").Borders(xlEdgeBottom).LineStyle = xlNone 'OK
Range("J229").Borders(xlEdgeRight).LineStyle = xlNone 'OK
End If
Application.EnableEvents = True
End If

The problem: When I select "Yes" in F229, I only get the LEFT border on the
yellow cell. The other three borders don't appear.

Any thoughts as to what's going on?

Help is appreciated.




 
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
Why _Change(ByVal Target As Range) Jim at Eagle Excel Programming 4 May 11th 05 07:36 PM
Ranges:Target in Worksheet_SelectionChange(ByVal Target As Range) Kevin McCartney Excel Programming 3 April 15th 05 01:51 PM
ByVal Target As Range monir Excel Programming 4 April 12th 05 04:37 PM
what does (ByVal Target As Range) mean Zygoid[_7_] Excel Programming 6 January 31st 04 05:08 PM
Many Sub Worksheet_Change(ByVal Target As Range) In One Worksheet MathewPBennett Excel Programming 4 December 24th 03 01:01 PM


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