Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dim Array as Byte
What would be the advantage to dimensioning an array as a Byte - such as:
Arr() As Byte Thanks EM |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dim Array as Byte
There isn't really any advantage unless it is required by the
procedure to which you are passing it. As a general coding practice, it is best to use Longs or Doubles for numeric variables. Forget about Integers and Singles. A typical computer today has memory to spare and the savings gained by using Bytes, Integers, or Singles are miniscule. If you are that concerned about memory usage, you shouldn't be using VBA in the first place. Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Fri, 29 May 2009 13:01:01 -0700, ExcelMonkey wrote: What would be the advantage to dimensioning an array as a Byte - such as: Arr() As Byte Thanks EM |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dim Array as Byte
Sub UseByteArr()
Dim arr() As Byte Dim s As String Dim l As Long s = "test" arr = s For l = 0 To UBound(arr) Step LenB("A") Debug.Print arr(l) Debug.Print Chr(arr(l)) Next End Sub regards r http://excelvba.altervista.org/blog/...ternative.html "ExcelMonkey" wrote: What would be the advantage to dimensioning an array as a Byte - such as: Arr() As Byte Thanks EM |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dim Array as Byte
I agree with what Chip says, functionally it is not going to net much in
today's real world, unless maybe you have millions of elements in the array. After all, you are not designing a game for the Atari 2600 and limited to < 4K of space. One advantage I can think of, however, is that it is self-documenting, much like a Boolean is. -- Regards, Tim Zych http://www.higherdata.com Workbook Compare - Excel data comparison utility "ExcelMonkey" wrote in message ... What would be the advantage to dimensioning an array as a Byte - such as: Arr() As Byte Thanks EM |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Dim Array as Byte
The main advantage is more efficient processing of characters in strings.
Assigning a string to a byte array and then looping thru the byte array is much more efficient than looping through the characters in the string using MID. regards Charles Williams Decision Models "ExcelMonkey" wrote in message ... What would be the advantage to dimensioning an array as a Byte - such as: Arr() As Byte Thanks EM |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Xors and byte arrays | Excel Programming | |||
Byte Codes | Excel Discussion (Misc queries) | |||
Passing Byte array to DLL | Excel Programming | |||
Excel Byte Calculation | Excel Worksheet Functions | |||
Double-byte challenges. Please help! | Excel Programming |