nrschmid,
See if this is what you are looking for. The macro will create a new worksheet Report.
Detach/open workbook CreateReport w1 wR VP - nrschmid - EF784488 - SEG12.xls and run the CreateReport macro.
If you want to use the macro on another workbook:
Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).
1. Copy the below code, by highlighting the code and pressing the keys CTRL + C
2. Open your workbook
3. Press the keys ALT + F11 to open the Visual Basic Editor
4. Press the keys ALT + I to activate the Insert menu
5. Press M to insert a Standard Module
6. Where the cursor is flashing, paste the code by pressing the keys CTRL + V
7. Press the keys ALT + Q to exit the Editor, and return to Excel
8. To run the macro from Excel, open the workbook, and press ALT + F8 to display the Run Macro Dialog. Double Click the macro's name to Run it.
Option Explicit
Sub CreateReport()
' stanleydgromjr, 07/16/2011
' http://www.excelforum.com/excel-general/784488-excel-2003-creating-complex-report.html
Dim w1 As Worksheet, wR As Worksheet
Dim LC As Long, a As Long, NR As Long
Dim c As Range, firstaddress As String
Application.ScreenUpdating = False
Set w1 = Worksheets("Sheet1")
If Not Evaluate("ISREF(Report!A1)") Then Worksheets.Add(After:=w1).Name = "Report"
Set wR = Worksheets("Report")
wR.UsedRange.Clear
LC = w1.Cells(1, Columns.Count).End(xlToLeft).Column
NR = 0
For a = 2 To LC Step 1
NR = NR + 1
With wR.Cells(NR, 1)
.Value = w1.Cells(1, a)
.Font.Bold = True
End With
firstaddress = ""
With w1.Columns(a)
Set c = .Find("X", LookIn:=xlValues, LookAt:=xlWhole)
If Not c Is Nothing Then
firstaddress = c.Address
Do
NR = NR + 1
wR.Cells(NR, 1) = w1.Cells(c.Row, 1)
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstaddress
End If
End With
NR = NR + 1
Next a
wR.UsedRange.Columns.AutoFit
wR.Activate
Application.ScreenUpdating = True
End Sub
Then run the CreateReport macro.
Bookmarks