![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Join Date: Aug 2003
Posts: 400
|
Is there a way to use VBA to filter to show only cells with borders? I am specifically working with cells in Column J.
Thanks in advance, XLML Using XL2000 |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: California
Posts: 3,857
|
Try this:
Code:
Sub test()
Dim x As Long
Dim LastRow As Long
LastRow = Range("J65536").End(xlUp).Row + 100
For x = 1 To LastRow
If Range("J" & x).Borders(xlEdgeLeft).LineStyle = xlContinuous Then
Else
Range("J" & x).RowHeight = 0
End If
Next x
End Sub
|
|
|
|
|
|
#3 |
|
Join Date: Aug 2003
Location: England
Posts: 4,584
|
Hello,
Not certain of what you are trying to achieve but is this code any use, it hides rows where the J column cell has a border on the left or the right Code:
Sub FILTER_BORDERS()
For MY_ROWS = 1 To Range("J65536").End(xlUp).Row
If Range("J" & MY_ROWS).Borders(xlEdgeLeft).LineStyle > 0 Or _
Range("J" & MY_ROWS).Borders(xlEdgeRight).LineStyle > 0 Then
Rows(MY_ROWS).Hidden = True
End If
Next MY_ROWS
End Sub
__________________
------------------------- Hope this is helpful. ------------------------- only a drafter, but broadening my Excel knowledge. |
|
|
|
|
|
#4 |
|
Join Date: Aug 2003
Posts: 400
|
Thanks for the replies. Olnyadrafter - I want to show only rows with borders. DRJ - I am using your macro which works great but I was trying to use dropdown arrows. Is there a way to do this with the dropdown arrows so that I can hide/unhide?
XLML |
|
|
|
|
|
#5 |
|
MrExcel MVP
Join Date: Feb 2002
Location: California
Posts: 3,857
|
You mean likt the auto filter arrows? I don't think so. You can make a couple buttons and attach macros to hide and unhide the cells.
|
|
|
|
|
|
#6 |
|
Join Date: Aug 2003
Location: England
Posts: 4,584
|
Hello,
XLML This is the code to show rows with borders on the left or right in Column J, not sure what you mean by the down arrow. Code:
Sub FILTER_BORDERS()
For MY_ROWS = 1 To Range("J65536").End(xlUp).Row
If Range("J" & MY_ROWS).Borders(xlEdgeLeft).LineStyle < 0 And _
Range("J" & MY_ROWS).Borders(xlEdgeRight).LineStyle < 0 Then
Rows(MY_ROWS).Hidden = True
End If
Next MY_ROWS
End Sub
__________________
------------------------- Hope this is helpful. ------------------------- only a drafter, but broadening my Excel knowledge. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|