+ Reply to Thread
Results 1 to 3 of 3

Excel 2007 BUG UsedRange/LastCell differences with Excel2003.

  1. #1
    keepITcool
    Guest

    Excel 2007 BUG UsedRange/LastCell differences with Excel2003.


    In Excel 2003 the LastCell is reset when UsedRange method is called.
    This does not happen in Excel2007

    Try following macro in Excel2003 and Excel2007

    Sub LastCellBug()

    Cells(1000, 100).Value = 1
    Cells(1000, 100).Clear
    Debug.Print "Before Save"
    Debug.Print ActiveSheet.UsedRange.Address
    Debug.Print Cells.SpecialCells(xlCellTypeLastCell).Address
    ActiveWorkbook.SaveAs "c:\temp.xls"
    Debug.Print "After Save"
    Debug.Print ActiveSheet.UsedRange.Address
    Debug.Print Cells.SpecialCells(xlCellTypeLastCell).Address

    End Sub


    --
    keepITcool
    | www.XLsupport.com | keepITcool chello nl | amsterdam

  2. #2
    Jim Rech
    Guest

    Re: Excel 2007 BUG UsedRange/LastCell differences with Excel2003.

    Too bad. I use that even though a save resets the used range too. I doubt
    it's a bug in the MS sense though. Have you reset your default file save as
    file type? I had to change to this to not error:

    ActiveWorkbook.SaveAs "c:\temp.xls", xlExcel8

    --
    Jim
    "keepITcool" <[email protected]> wrote in message
    news:[email protected]...
    |
    | In Excel 2003 the LastCell is reset when UsedRange method is called.
    | This does not happen in Excel2007
    |
    | Try following macro in Excel2003 and Excel2007
    |
    | Sub LastCellBug()
    |
    | Cells(1000, 100).Value = 1
    | Cells(1000, 100).Clear
    | Debug.Print "Before Save"
    | Debug.Print ActiveSheet.UsedRange.Address
    | Debug.Print Cells.SpecialCells(xlCellTypeLastCell).Address
    | ActiveWorkbook.SaveAs "c:\temp.xls"
    | Debug.Print "After Save"
    | Debug.Print ActiveSheet.UsedRange.Address
    | Debug.Print Cells.SpecialCells(xlCellTypeLastCell).Address
    |
    | End Sub
    |
    |
    | --
    | keepITcool
    || www.XLsupport.com | keepITcool chello nl | amsterdam



  3. #3
    keepITcool
    Guest

    Re: Excel 2007 BUG UsedRange/LastCell differences with Excel2003.


    I did a few checks:

    Default format (Excel Options): Excel Workbook

    Activeworkbook.SaveAs "c:\temp.xls"
    (not specifying fileformat, specifying 'wrong' extension)
    in Excel2007 saves with xls extension in xlsx fileformat without
    warnings. (same if you use .txt extension)

    Activeworkbook.SaveAs "c:\test" Saves C:\Test.xlsx

    the xls will open without errors in Excel2007,
    but must be renamed to .xlsx to open in Excel2003 (with converter)


    --
    keepITcool
    | www.XLsupport.com | keepITcool chello nl | amsterdam


    Jim Rech wrote in <news:<[email protected]>

    > Too bad. I use that even though a save resets the used range too. I
    > doubt it's a bug in the MS sense though. Have you reset your default
    > file save as file type? I had to change to this to not error:
    >
    > ActiveWorkbook.SaveAs "c:\temp.xls", xlExcel8


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1