View only items in the left column that have X's in right columns

T

townieflo

I'm sure there is a simple function for this.

I have a master list of items in my far left column. The columns to their
right use various combinations of the masterlist for which I have placed an X
within the column in line/the row of the masterlist on the left.

How do I get the program to sort or eliminate both the items or rows not
with an X from the master list on the left along with eliminating from view
all the other columns but the one selected?

I want to be able to print individual reports showing how each individual
column matchs up with the master list. HELP
 
B

bob777

I think the reason you have no replies is that the problem is not
understood. Could you give an example such cells A1 to A5 contain the
names of 5 items of equipment, cells B1 to B5 contain X's or Y's, cells
C1 to C5 contain X's or Z's.

I want to be able to.....................
 
D

Dave Peterson

Manually, you could hide all the columns that you don't want to see, then filter
to show the non-blanks in that column. Then print that "view". Repeat as
required.

You could have a macro do it, too.

Option Explicit
Sub testme()

Dim iCol As Long
Dim myRng As Range
Dim LastRow As Long
Dim LastCol As Long
Dim wks As Worksheet

Set wks = Worksheets("sheet1")

With wks
.AutoFilterMode = False
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column

Set myRng = .Range("a1", .Cells(LastRow, LastCol))

myRng.AutoFilter

For iCol = 2 To LastCol
.Range("b1", .Cells(1, LastCol)).EntireColumn.Hidden = True
.Cells(1, iCol).EntireColumn.Hidden = False
If .FilterMode Then
.ShowAllData
End If
myRng.AutoFilter Field:=iCol, Criteria1:="<>"
If myRng.Columns(1).Cells.SpecialCells(xlCellTypeVisible) _
.Cells.Count = 1 Then
'don't print--no data, just header row
Else
.PrintOut preview:=True
End If
Next iCol

.Range("b1", .Cells(1, LastCol)).EntireColumn.Hidden = False
If .FilterMode Then
.ShowAllData
End If
End With

End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top