Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default Finding the "Size" of Each Sheet in a Workbook

Hi

Has anyone got some code for finding the underlying size
of each sheet in a workbook. I have in mind a piece of
code to output each sheet to a separate file in the "Temp"
directory to determine its size.

I looked in the archives but the search returned responses
regarding the output of modules and forms.

Thanks

Tim
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 968
Default Finding the "Size" of Each Sheet in a Workbook

Hi Tim,

You could save as a different name, then loop on:
- measure file size
- delete a sheet
- save

something like (not tested)


application.screenupdating=false
application.calculation=xlcalculationmanual
Application.calculatebeforesave=false
application.displayalerts=false
activeworkbook.savecopyas filename:="BigBook.Bak"
activeworkbook.saveas filename="BigBook.xls"
set oBk=Workbooks("bigBook")
debug.print FileLen(oBk.FullName)

on error resume next
for each oSht in oBk.worksheets
osht.delete
obk.save
debug.print FileLen(oBk.FullName)
next osht

FastExcel uses a similar approach for determining worksheet memory.


regards
Charles
______________________
Decision Models
The Excel Calculation Site
www.DecisionModels.com

"Tim Childs" wrote in message
...
Hi

Has anyone got some code for finding the underlying size
of each sheet in a workbook. I have in mind a piece of
code to output each sheet to a separate file in the "Temp"
directory to determine its size.

I looked in the archives but the search returned responses
regarding the output of modules and forms.

Thanks

Tim



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default Finding the "Size" of Each Sheet in a Workbook

?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ????.????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ?????????????????????????????????????????????????? ??????????????????????????????????????????
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default Finding the "Size" of Each Sheet in a Workbook

Charles

I must apologise for that e-mail sent on Friday with all the question marks:
I don't how it ended up like that: most bizarre. (Like I went to sleep
pressing the "?" key !)

Many thanks for coming back with version 2 - it is really good. Much
appreciated.

Regards

Tim



"Charles Williams" wrote in message
...
???????????????????? maybe you want something a bit more tested
??????????????
- watch for line wrap

Option Explicit
Sub SheetSizer()

' determine the filesize of each sheet in a workbook
' Charles Williams 25/7/2003

Dim oBk As Workbook
Dim oSht As Worksheet
Dim strSheetname As String
Dim jSize As Long

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Application.CalculateBeforeSave = False
Application.DisplayAlerts = False

ActiveWorkbook.SaveCopyAs FileName:="BigBook.Bak"
ActiveWorkbook.SaveAs FileName:="BigBook.xls"

Set oBk = Workbooks("bigBook.xls")
jSize = FileLen(oBk.FullName)

Debug.Print "Book " & CStr(jSize \ 1024) & "KB"

On Error Resume Next
For Each oSht In oBk.Worksheets
strSheetname = oSht.Name
oSht.Delete
oBk.Save
If oBk.Worksheets.Count 1 Then
Debug.Print "Sheet " & strSheetname & " " & CStr((jSize -
FileLen(oBk.FullName)) \ 1024) & "KB"
End If
jSize = FileLen(oBk.FullName)
Next oSht

Debug.Print "Sheet " & strSheetname & " " & CStr((jSize) \ 1024) &

"KB"

Set oSht = Nothing
Set oBk = Nothing
End Sub


regards
Charles
______________________
Decision Models
The Excel Calculation Site
www.DecisionModels.com
"Tim Childs" wrote in message
...

?????????????????????????????????????????????????? ??????????????????????????

?????????????????????????????????????????????????? ??????????????????????????

?????????????????????????????????????????????????? ??????????????????????????

?????????????????????????????????????????????????? ??????????????????????????

?????????????????????????????????????????????????? ??????????????????????????

?????????????????????????????????????????????????? ??????????????????????????

????????????????????????????????????????????????.? ??????????????????????????

?????????????????????????????????????????????????? ??????????????????????????

?????????????????????????????????????????????????? ??????????????????????????
?????????????????????????????????????????????????? ????????





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default Finding the "Size" of Each Sheet in a Workbook

Charles

The other thing I learned from your post was the use of the operator "\" as
opposed to "/".

That's very neat and helpful rather than having to use a function to convert
to integer format.

THANKS

Tim


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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Excel "Move or Copy" and "Delete" sheet functions dsiama Excel Worksheet Functions 1 December 28th 07 01:57 PM
how to increase size of "name box" and "contents of cell " displa. Stubby- LIBERTY New Users to Excel 2 February 22nd 07 06:43 PM
cannot use "Create List" and "Share Workbook" same time Devendra Excel Discussion (Misc queries) 0 October 26th 06 06:05 AM
"SHEET TAB FONT SIZE"? leesmile Excel Worksheet Functions 4 October 14th 06 12:36 AM


All times are GMT +1. The time now is 09:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"