
Originally Posted by
joh46k
I have a file , in which every week i will update data. First,i will enter week number, next i will fill up some data on two columns (material no and part id). After that I press update button
i need to see "Outside borders" automatically drawn.
pls help me , how to do that?

I don't understand your request ! but I try to write a code --> You can test this code ?
Run sub NHM ()
Private Sub CommandButton1_Click()
NHM
End Sub
'=================================================
Sub NHM()
Dim rng As Range, myRng As Range
On Error Resume Next
Application.ScreenUpdating = False
Set rng = Range("C2", [C65536].End(3)).SpecialCells(4)
For Each myRng In rng.Areas
Noborders myRng.Offset(-1, -1).Resize(myRng.Rows.Count + 1, 12)
Borders myRng.Offset(-1, -1).Resize(myRng.Rows.Count + 1, 12)
Next
Application.ScreenUpdating = True
End Sub
'==========================================================
Private Sub Borders(rng As Range)
Dim Item, Arr()
Arr = Array(7, 8, 9, 10, 11, 12)
With rng
For Each Item In Arr
If Item = 12 Then
With .Borders(Item)
'.LineStyle = xlContinuous
'.Weight = xlHairline
End With
Else
With .Borders(Item)
.LineStyle = xlContinuous
.Weight = xlThin
End With
End If
Next
End With
End Sub
'=======================================
Private Sub Noborders(rng As Range)
Dim Arr(), Item
Arr = Array(5, 6, 7, 8, 9, 10, 11, 12)
With rng
For Each Item In Arr
.Borders(Item).LineStyle = xlNone
Next
End With
End Sub
Bookmarks