LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro Opening or Looking for Another Workbook


Hello: This has two (2) questions:

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

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

Any help with both these problems will greatly be appreciated. Here i
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.

Stev

--
Toolman04
-----------------------------------------------------------------------
Toolman045's Profile: http://www.excelforum.com/member.php...fo&userid=3532
View this thread: http://www.excelforum.com/showthread.php?threadid=55098

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Opening a Workbook with a Macro Eli[_4_] Excel Discussion (Misc queries) 4 October 3rd 08 12:13 AM
Enable macro on opening workbook ASU Excel Discussion (Misc queries) 5 July 3rd 06 05:40 PM
Programming a macro to run on opening a workbook mike Excel Programming 3 October 27th 05 01:07 PM
Run macro when opening workbook nsv Excel Discussion (Misc queries) 4 September 6th 05 12:19 PM
How to make macro available to all workbook w/o opening VBA crapit Excel Programming 3 May 19th 05 05:27 PM


All times are GMT +1. The time now is 05:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"