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 |
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 |
All times are GMT +1. The time now is 01:59 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com