Hello: This has two (2) questions:

The first and annoying question is: I have the following macro that was built to group items with a + symbol in front. It works great except that it is always looking for the original workbook it was created in. I opened the original workbook and copied then paste in another workbook. If I move the original workbook the macro fails in the file I pasted the macro. It probably is something relatively easy that I am missing.

2nd: I added a macro that will collapse the groups after my worksheet is updated. It does not recognize the coding on the bottom.

Any help with both these problems will greatly be appreciated. Here is my code:


Sub GroupData()

Dim wb As Workbook, ws As Worksheet
Dim cel As Range, GroupStart As Range, FirstCel As Boolean
Set wb = ActiveWorkbook

For Each ws In wb.Worksheets
If ws.Name = "52_Weeks" Or ws.Name = "13_Weeks" Or ws.Name = "YTD" Then
ws.Activate
ws.Cells.ClearOutline
For Each cel In ws.Range("A1", ws.Range("A65535").End(xlUp).Offset(1, 0))
If Left(cel, 1) = "+" And FirstCel = False Then
Set GroupStart = cel
FirstCel = True
End If
If Left(cel, 1) <> "+" And FirstCel = True Then
ws.Range(GroupStart, cel.Offset(-1, 0)).Select
Selection.Rows.Group
FirstCel = False
End If
If cel.Address = ws.Range("A65535").End(xlUp).Offset(1, 0) Then
ws.Range(GroupStart, cel.Offset(-1, 0)).Select
Selection.Rows.Group
FirstCel = False
End If


Next cel
End If
Next ws

Sheets("YTD").Select
ActiveSheet.Outline.ShowLevels RowLevels:=1
Range("A1").Select
Sheets("52_Weeks").Select
ActiveSheet.Outline.ShowLevels RowLevels:=1
Range("A1").Select
Sheets("13_Weeks").Select
ActiveSheet.Outline.ShowLevels RowLevels:=1
Range("A1").Select

End Sub



Again, thanks for your help.

Steve