ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   an excellent time waster (https://www.excelbanter.com/excel-programming/347235-excellent-time-waster.html)

Jeff[_42_]

an excellent time waster
 
Open a new blank workbook, go to the VBA immediate window and type cells = 1. This will fill every
cell in sheet1 with a number 1. Save the file as number1.xls and close the file.

Open another new blank workbook, go to the VBA immediate window and type cells = "a". This will
fill every cell in sheet1 with a letter a. Save the file as lettera.xls and close the file.

Now bring up the windows explorer and look at the size of both files. Why is the file with the
letter "a" bigger than the file with the number 1? I thought a number takes up more bytes than a
single letter.

As a control experiment, try running the following procedure twice, once with a number and once with
a letter. This fills every cell in the entire workbook. You may want to defrag your drive and
and/or turn your cpu fan on high. This procedure will put quite a strain on your puter's ticker.

Sub fillworkbook()
Dim i as Worksheet

For Each i in Sheets
i.cells = 1
Next i

End



Nigel

an excellent time waster
 
Sure is a time waster but if you are interested in how Excel BIFF files are
structured then take a peek here....

http://sc.openoffice.org/excelfileformat.pdf

--
Cheers
Nigel



"Jeff" wrote in message
...
Open a new blank workbook, go to the VBA immediate window and type cells =

1. This will fill every
cell in sheet1 with a number 1. Save the file as number1.xls and close

the file.

Open another new blank workbook, go to the VBA immediate window and type

cells = "a". This will
fill every cell in sheet1 with a letter a. Save the file as lettera.xls

and close the file.

Now bring up the windows explorer and look at the size of both files. Why

is the file with the
letter "a" bigger than the file with the number 1? I thought a number

takes up more bytes than a
single letter.

As a control experiment, try running the following procedure twice, once

with a number and once with
a letter. This fills every cell in the entire workbook. You may want to

defrag your drive and
and/or turn your cpu fan on high. This procedure will put quite a strain

on your puter's ticker.

Sub fillworkbook()
Dim i as Worksheet

For Each i in Sheets
i.cells = 1
Next i

End






All times are GMT +1. The time now is 01:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com