Hi,

i have the following code which works well, except that it wipes out the gridlines. The only gridlines it does keep are the ones around the cells containing information. Any one any ideas how i can place grid lines around all the rows or for the first 40 rows?

Sub CommandButton3_Click()

Dim d1 As Date, d2 As Date, d As Date, i As Long, n As Long, j As Integer, k As Long, t As Worksheet

d1 = Range("f2")

d2 = Range("h2")

Set t = Worksheets("DUE")

t.UsedRange.Offset(1, 0).Clear

n = Range("P65536").End(xlUp).Row

k = 1

For i = 7 To n

For j = 9 To 16

d = Cells(i, j)

If d >= d1 And d <= d2 Then

k = k + 1

Range("A" & i & ":D" & i).Copy t.Cells(k, 1)

With t.Cells(k, 7)

.Value = d

.NumberFormat = Cells(i, j).NumberFormat

End With

Exit For

End If

Next j

Next i

t.Activate

End Sub

Regards

Bob