Results 1 to 4 of 4
  1. #1
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro failing to work (2003)

    The problem is that Worksheets(1) is not a sheet named "1" but the first sheet in the workbook. I'd name the sheets S0, S1 etc. (or similar)

    Set oTgt = Worksheets("S" & oMst.Range("A1").Offset(I, 1).Value)

    and

    oTgt.Name = "S" & oMst.Range("A1").Offset(I, 1).Value

    You'll have to adjust the code at the end accordingly.

  2. #2
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    La Jolla, CA
    Posts
    1,469
    Thanks
    30
    Thanked 61 Times in 57 Posts

    Macro failing to work (2003)

    Hans,

    The attached workbook uses a macro called "separate" which you generously helped me create (actually, you created about 99.9% for me, of course).
    For some reason (and I cannot tell), the macro all of a sudden is failing.

    In brief, it was suppose to look at the MasterSheet, column B, and create new sheets separating the information into the individual codes (0, 1, etc.).
    And, doing a minor calculation as well.

    Can you easily put your finger on the issue, and why this would have happened when it's been working just fine for months!?

    Thanks, in advance,

    Kevin

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    La Jolla, CA
    Posts
    1,469
    Thanks
    30
    Thanked 61 Times in 57 Posts

    Re: Macro failing to work (2003)

    Thanks, Hans.
    That seems to have resolved the problem. But, I'm not sure why it was working for months using the original code. Maybe just lucky?
    I deleted the attachment for privacy reason.

    Thanks, again!

    Kevin

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro failing to work (2003)

    I guess you either had text values in column B before, or if they were numeric, you didn't have zeros - Worksheets(0) generates an error because counting starts at 1.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •