Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Excel Macro works in 2000 but not 2003  (Read 4409 times)

0 Members and 1 Guest are viewing this topic.

bucklsu

  • Guest
Excel Macro works in 2000 but not 2003
« on: June 01, 2007, 01:21:46 PM »
I have a problem that occurs with MS Excel 2003  Professional but not MS Excel 2000 Professional.    I am on Windows XP.
The Macro runs without an error message, but instead of completing, it seems to be stuck in a loop where it keeps forcing blank lines to print.
The piece of code causing the problem is below:

Set myRange = ActiveSheet.UsedRange
    For Each rw In myRange.Rows
   
        If insertNextRow Then
            Rows(rw.Row).Select
            Selection.Insert Shift:=xlDown
        End If
       
        insertNextRow = False
        If rw.OutlineLevel = 3 Then
            insertNextRow = True
        End If
       
    Next rw

This part of the macro inserts a row between subtotalled groups only.  This works in Excel 2000 but in Excel 2003 it will keep inserting lines forever unless you break out of the macro.
?? 

soybean



    Genius
  • The first soybean ever to learn the computer.
  • Thanked: 469
  • Computer: Specs
  • Experience: Experienced
  • OS: Windows 10
Re: Excel Macro works in 2000 but not 2003
« Reply #1 on: June 01, 2007, 03:34:01 PM »
bucklsu, welcome to the forum but I'm actually going to shoo you away.  We don't get  many Excel questions here, especially like yours.  I'm an Excel user but not very proficient with VBA in macros.  So, I suggest you visit http://www.excelforum.com/.  I just think you'll get a faster response there to your question. 

bucklsu

  • Guest
Re: Excel Macro works in 2000 but not 2003
« Reply #2 on: June 04, 2007, 07:41:18 AM »
Thank you, soybean, I'll do just that.   :-*