Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Creating Borders with a formula

I am trying to create a top border for a row evverytime
one of the column H is = 1. If anyone knows please post
it or e-mail me at .

Thanks,
Jeff Fink
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default Creating Borders with a formula

Put the following code behind the worksheet you wish to apply a top border
to a row when the vlaue in column H is set to a 1.
The code is triggered by a change of cell selection and works by scanning
column H from row1 until the last row where column H has a value. If the
value in column H (current row) equals 1 then the entire row topborder is
turned on, else turned off.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim lstrow As Long
Dim i As Long
lstrow = Cells(Rows.Count, "H").End(xlUp).Row
For i = 1 To lstrow
With Rows(i).Borders(xlEdgeTop)
If Range("H" & i).Value = 1 Then
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
Else
.LineStyle = xlNone
End If
End With
Next i
End Sub

Cheers
Nigel

"Jeff Fink" wrote in message
...
I am trying to create a top border for a row evverytime
one of the column H is = 1. If anyone knows please post
it or e-mail me at .

Thanks,
Jeff Fink



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
Creating borders via Conditional Formatting WLMPilot Excel Discussion (Misc queries) 1 November 8th 07 12:33 AM
Transparent Cell Borders For Formula Cells? Naji Excel Discussion (Misc queries) 2 July 19th 07 04:37 PM
Borders on cells included in formula while editing gishi Setting up and Configuration of Excel 1 July 27th 06 11:06 PM
Cell borders with formula edits Katie Excel Discussion (Misc queries) 0 June 5th 06 02:34 PM
Creating cells with Diagonal borders Graham Tritton Excel Discussion (Misc queries) 1 January 24th 06 06:09 AM


All times are GMT +1. The time now is 11:51 AM.

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"