Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Bit manipulation

Hi all,

Does VBA (Excel 97) have bit manipulation functions -
shiftleft/right etc? I couldn't find anything that looked
promising.

Tony
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default Bit manipulation

Nope... nothing direct. You could write a program in C/C++ and call that
program through the shell command. That is probably your best option...

HTH

"Tony" wrote:

Hi all,

Does VBA (Excel 97) have bit manipulation functions -
shiftleft/right etc? I couldn't find anything that looked
promising.

Tony

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Bit manipulation

Or create your own

Function BitShiftRight(Val As Long, NumBits As Integer) As Long
BitShiftRight = Val * (2 ^ NumBits)
End Function

Function BitShiftLeft(Val As Long, NumBits As Integer) As Long
BitShiftLeft = Val \ (2 ^ NumBits)
End Function


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jim Thomlinson" wrote in message
...
Nope... nothing direct. You could write a program in C/C++ and call that
program through the shell command. That is probably your best option...

HTH

"Tony" wrote:

Hi all,

Does VBA (Excel 97) have bit manipulation functions -
shiftleft/right etc? I couldn't find anything that looked
promising.

Tony



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default Bit manipulation

That is good for a shift but any idea how you would get any of the other
bitwise operators? I still say you go with C/C++. As an aside to do a bit
shift you should just be able to multiply or divide by 2 which in base 2 will
functionally shift the bits? I think... I am sure you will let me know Bob...
:)

"Bob Phillips" wrote:

Or create your own

Function BitShiftRight(Val As Long, NumBits As Integer) As Long
BitShiftRight = Val * (2 ^ NumBits)
End Function

Function BitShiftLeft(Val As Long, NumBits As Integer) As Long
BitShiftLeft = Val \ (2 ^ NumBits)
End Function


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jim Thomlinson" wrote in message
...
Nope... nothing direct. You could write a program in C/C++ and call that
program through the shell command. That is probably your best option...

HTH

"Tony" wrote:

Hi all,

Does VBA (Excel 97) have bit manipulation functions -
shiftleft/right etc? I couldn't find anything that looked
promising.

Tony




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Bit manipulation

Give us a break Jim, he only mentioned shifting :-)

Which others are you thinking of, VBA has AND, OR, XOR, IMP and so on?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jim Thomlinson" wrote in message
...
That is good for a shift but any idea how you would get any of the other
bitwise operators? I still say you go with C/C++. As an aside to do a bit
shift you should just be able to multiply or divide by 2 which in base 2

will
functionally shift the bits? I think... I am sure you will let me know

Bob...
:)

"Bob Phillips" wrote:

Or create your own

Function BitShiftRight(Val As Long, NumBits As Integer) As Long
BitShiftRight = Val * (2 ^ NumBits)
End Function

Function BitShiftLeft(Val As Long, NumBits As Integer) As Long
BitShiftLeft = Val \ (2 ^ NumBits)
End Function


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jim Thomlinson" wrote in

message
...
Nope... nothing direct. You could write a program in C/C++ and call

that
program through the shell command. That is probably your best

option...

HTH

"Tony" wrote:

Hi all,

Does VBA (Excel 97) have bit manipulation functions -
shiftleft/right etc? I couldn't find anything that looked
promising.

Tony








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default Bit manipulation

shiftleft/right etc? How about etc... And those operators you mention are
not bitwise are they. If they can be used bitwise let me know... That would
be kinda cool...

:)

"Bob Phillips" wrote:

Give us a break Jim, he only mentioned shifting :-)

Which others are you thinking of, VBA has AND, OR, XOR, IMP and so on?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jim Thomlinson" wrote in message
...
That is good for a shift but any idea how you would get any of the other
bitwise operators? I still say you go with C/C++. As an aside to do a bit
shift you should just be able to multiply or divide by 2 which in base 2

will
functionally shift the bits? I think... I am sure you will let me know

Bob...
:)

"Bob Phillips" wrote:

Or create your own

Function BitShiftRight(Val As Long, NumBits As Integer) As Long
BitShiftRight = Val * (2 ^ NumBits)
End Function

Function BitShiftLeft(Val As Long, NumBits As Integer) As Long
BitShiftLeft = Val \ (2 ^ NumBits)
End Function


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jim Thomlinson" wrote in

message
...
Nope... nothing direct. You could write a program in C/C++ and call

that
program through the shell command. That is probably your best

option...

HTH

"Tony" wrote:

Hi all,

Does VBA (Excel 97) have bit manipulation functions -
shiftleft/right etc? I couldn't find anything that looked
promising.

Tony







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
Value manipulation Vic Excel Discussion (Misc queries) 3 April 3rd 09 03:18 PM
Data Manipulation. Wilson Excel Discussion (Misc queries) 0 August 13th 08 03:06 PM
Can I do graphic manipulation with VBA? Michael VS Excel Programming 0 January 12th 04 01:09 PM
string manipulation Craig[_8_] Excel Programming 2 January 7th 04 05:00 AM
String Manipulation Ray Batig Excel Programming 3 December 23rd 03 12:31 AM


All times are GMT +1. The time now is 05:58 PM.

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

About Us

"It's about Microsoft Excel"