View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_2_] Don Guillett[_2_] is offline
external usenet poster
 
Posts: 1,522
Default length of line depending on the value of the cell

On Aug 15, 7:06*am, "Vacuum Sealed" wrote:
You could try this:

Place this behind your Sheet, it will update evrytime the value changes.

You will have to enter however many additional arguments you want based on
how many lines across the sheet you want to go.

HTH
Mick.

Private Sub Worksheet_Change(ByVal Target As Range)
* If Not Intersect(Target, Range("A1")) Is Nothing Then
* * * * Select Case True
* * * * * * Case Target.Value = 1
* * * * * * * * Rows("1:1").Borders(xlEdgeBottom).LineStyle = xlNone
* * * * * * * * With Range("B1:C1").Borders(xlEdgeBottom)
* * * * * * * * .LineStyle = xlContinuous
* * * * * * * * .ColorIndex = 0
* * * * * * * * .TintAndShade = 0
* * * * * * * * .Weight = xlThin
* * * * * * * * End With
* * * * * * Case Target.Value = 2
* * * * * * * * Rows("1:1").Borders(xlEdgeBottom).LineStyle = xlNone
* * * * * * * * With Range("B1:D1").Borders(xlEdgeBottom)
* * * * * * * * .LineStyle = xlContinuous
* * * * * * * * .ColorIndex = 0
* * * * * * * * .TintAndShade = 0
* * * * * * * * .Weight = xlThin
* * * * * * * * End With
* * * * End Select
*End If
End Sub


RE sending
Right click sheet tabview codeinsert this

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub
Rows(1).Borders(xlEdgeBottom).LineStyle = xlNone
Range(Cells(1, 1), Cells(1, Target)) _
..Borders(xlEdgeBottom).LineStyle = xlContinuous
End Sub