Thread: Apply Border
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rowan[_2_] Rowan[_2_] is offline
external usenet poster
 
Posts: 226
Default Apply Border

This should get you started. If not you will need to make your explanation a
little clearer. E.G. do you want the last used column to have a right border
or is it the first empty column that has the border.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim endCol As Integer
If Target.Row = 3 And Target.Column 2 And _
Target.Value = 1 Then
With Range(Cells(5, Target.Column), Cells(56, Target.Column))
.Borders(xlEdgeLeft).Weight = xlThick
End With
endCol = Cells(3, Columns.Count).End(xlToLeft).Column
With Range(Cells(5, endCol), Cells(56, endCol))
.Borders(xlEdgeRight).Weight = xlThick
End With
End If
End Sub

Regards
Rowan

"Bill" wrote:

I cannot use conditional formatting because each of the three blocks already
has formulas in them. Plus I need to accomplish to actions with these code.

So I would like some assistance in developing the code to utilize the
Worksheet_Change event using VBA.

1. I am trying to apply a thick border to the left side of the column
running from row 5 through row 56 for any column when the value in row 3 of
that column equals 1.

Thanks Bill

2. The code would need to check row 3 starting with column C going right.
Example check C3, D3 E3€¦. When the code hits the last cell that does not
contain a value then I need to apply a thick border to the right side of the
column running from row 5 through row 56 for the ending row