Hello all
I am trying to format ALL cells within the list, to have gird lines around the cell, including the hidden cells, so that when the filter is removed all cells have been formatted the same.
As you can imagine it works fine for the unhidden cells but leaves blanks around the filtered values the code is
Public Sub testingblanks()
lRow = Cells(65536, 1).End(xlUp).Row
For r = 3 To lRow
If (Worksheets("Sheet1").Rows(r).Hidden = False And (Cells(r, 4) <> "")) Then
Module1.addcol
End
Else
UserForm1.Show
End
End If
Next r
End Sub
Public Sub addcol()
Columns("D
").Select
Selection.Insert Shift:=xlToRight
Range("d3:d194").Select
'Do stuff
'obviously for appearance purposes only the follwing formats the column
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Cells(1, 1).Select
UserForm1.Show
End Sub
Is this possible?It makes the eerything easier to read thats all.
If it is Im done hurray!!!!!
Cheers
Neil
I am trying to format ALL cells within the list, to have gird lines around the cell, including the hidden cells, so that when the filter is removed all cells have been formatted the same.
As you can imagine it works fine for the unhidden cells but leaves blanks around the filtered values the code is
Public Sub testingblanks()
lRow = Cells(65536, 1).End(xlUp).Row
For r = 3 To lRow
If (Worksheets("Sheet1").Rows(r).Hidden = False And (Cells(r, 4) <> "")) Then
Module1.addcol
End
Else
UserForm1.Show
End
End If
Next r
End Sub
Public Sub addcol()
Columns("D
Selection.Insert Shift:=xlToRight
Range("d3:d194").Select
'Do stuff
'obviously for appearance purposes only the follwing formats the column
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With Selection.Borders(xlInsideHorizontal)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
Cells(1, 1).Select
UserForm1.Show
End Sub
Is this possible?It makes the eerything easier to read thats all.
If it is Im done hurray!!!!!
Cheers
Neil