Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Why is worksheet.usedrange empty?
Hi,
I want to copy the data in one worksheet into an other worksheet in a new workbook. This is my code: Private Sub Workbook_BeforeClose(Cancel As Boolean) Worksheets("Sheet1").Activate ActiveSheet.UsedRange.Select Selection.Copy Workbooks.Add ActiveSheet.Paste Application.CutCopyMode = False ActiveWorkbook.SaveAs Filename:="C:\NewCopiedBook.xls", FileFormat:= _ xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _ , CreateBackup:=False ActiveWindow.Close I can see the cells being selected and copied. And a new workbook created and the cells being pasted. And then the new workbook being closed. But when I open it there is no data in the cells. When i debug I can see that the worksheet.usedrange is empty. The data in the "original" workbook from has just been pasted, probably not saved. But I tried to save the "original" workbook before the code above. What am I missing? /Sara |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
empty box/worksheet | Excel Discussion (Misc queries) | |||
Excel 2007 BUG UsedRange/LastCell differences with Excel2003. | Excel Discussion (Misc queries) | |||
Real Value of .UsedRange.Rows.Count | Excel Worksheet Functions | |||
How do I delete an empty worksheet. | Excel Worksheet Functions | |||
empty rows at bottom of worksheet | Excel Discussion (Misc queries) |