Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
keepITcool
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.misc
Jim Rech
 
Posts: n/a
Default 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" wrote in message
. com...
|
| 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   Report Post  
Posted to microsoft.public.excel.misc
keepITcool
 
Posts: n/a
Default 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

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
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
unhide menu bar in excel - just disappeared Sean Setting up and Configuration of Excel 12 April 4th 23 10:19 AM
Excel 2007 MS Query prompt yields Syntax error Bruce Excel Discussion (Misc queries) 0 May 26th 06 11:06 AM
enable automatic refresh Vass Excel Worksheet Functions 2 March 11th 06 04:36 AM
How do I compare excel spreadsheets, tracking the differences? Nic Excel Worksheet Functions 2 November 10th 05 07:25 PM
TRYING TO SET UP EXCEL SPREADSHEET ON MY COMPUTER MEGTOM New Users to Excel 5 October 27th 05 03:06 AM


All times are GMT +1. The time now is 03:51 PM.

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"