However, what's the logic of using BYTE???
A misguided effort to use the smallest possible data type.
Memory is so plentiful and cheap that it makes no sense to worry about
saving a byte here and there. (And if you were concerned to the point
where individual bytes really mattered, VBA is decidedly not the right
platform to begin with. Strict ANSI C, not even C++, for super tight
memory requirements.) All integral numerics should be Longs, as
software is optimized for 32 bits and short ints end up getting
converted to longs by the CPU. Floating points should always be
Doubles. Forget about Byte, Integer, and Single. On rare occasion you
may need an Byte array, but a single Byte variable is of no value.
And the code that Michelle posted, to which you are replying,
For y = 1 To 50000000
Next y
This is probably the absolutely worst way to cause some sort of pause
in code execution. A vastly better way is to use the SleepEx API:
Public Declare Function SleepEx Lib "kernel32" ( _
ByVal dwMilliseconds As Long, _
ByVal bAlertable As Long) As Long
Sub AAA()
Dim PauseSeconds As Long
PauseSeconds = 5
'
' your code here
'
' pause execution
SleepEx dwMilliseconds:=PauseSeconds * 1000&, bAlertable:=0
'
' the rest of your code here
'
End Sub
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)
On Sun, 13 Sep 2009 02:25:01 -0700, Faraz A. Qureshi
Thanx Michelle!
That was excellent! However, what's the logic of using BYTE???