Go Back   Trackpads Community > General Discussions > Computer and Technology > Microsoft Applications

Microsoft Applications Discussions about Windows and other MS Products such as Office

Reply
 
LinkBack Thread Tools
Old 01-28-2005, 20:00   #1 (permalink)
d_penny@usa.net
Civilians

 
Default in VBA how to retreive cell values 1 byte at a time?

How would I write VBA to retrieve (get at) the value in a cell byte by
byte from its natural form? i.e. no conversions are to be performed.
E.g., if a string, then I may get more bytes than for a number.

Thanks.

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Trackpads Information
Click to Visit
Old 01-28-2005, 20:00   #2 (permalink)
Earl Kiosterud
Civilians

 
Default Re: in VBA how to retreive cell values 1 byte at a time?

Penny,

If the cell contains text, you can retrieve characters (bytes) with the MID
function.
=MID(A2, CharPosition, 1). You can get the actual byte values with the CODE
function
=CODE(MID(A2, CharPosition, 1)).


If a number, you can extract the decimal digits of the number in the same
way, but you're not getting actual bytes (as stored by Excel). Excel stores
numbers in an IEEE floating point standard format, the IEEE number of which
I can't recall at the moment. All such numbers use 8 bytes for storage in
that format. If you want the ASCII code values for the decimal digits of
the number, use the formula above, as with text.



--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

<d_penny@usa.net> wrote in message
news:1106943156.716897.8170@c13g2000cwb.googlegrou ps.com...
> How would I write VBA to retrieve (get at) the value in a cell byte by
> byte from its natural form? i.e. no conversions are to be performed.
> E.g., if a string, then I may get more bytes than for a number.
>
> Thanks.
>



 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-29-2005, 00:00   #3 (permalink)
Bob Phillips
Civilians

 
Default Re: in VBA how to retreive cell values 1 byte at a time?

Dim myVal

For Each cell In Selection
myVal= cell.Text
Next cell

--

HTH

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


<d_penny@usa.net> wrote in message
news:1106943156.716897.8170@c13g2000cwb.googlegrou ps.com...
> How would I write VBA to retrieve (get at) the value in a cell byte by
> byte from its natural form? i.e. no conversions are to be performed.
> E.g., if a string, then I may get more bytes than for a number.
>
> Thanks.
>



 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 01-29-2005, 00:00   #4 (permalink)
Earl Kiosterud
Civilians

 
Default Re: in VBA how to retreive cell values 1 byte at a time?

Penny,

Oops. You said you wanted to do this in VBA.

For a character:
Mid(Range("A2"), CharPosition, 1)

For the ASCII code value:
Asc(Mid(Range("A2"), CharPosition, 1))
--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

"Earl Kiosterud" <nothanks@nospam.com> wrote in message
news:%23$RYOcYBFHA.4028@TK2MSFTNGP15.phx.gbl...
> Penny,
>
> If the cell contains text, you can retrieve characters (bytes) with the
> MID function.
> =MID(A2, CharPosition, 1). You can get the actual byte values with the
> CODE function
> =CODE(MID(A2, CharPosition, 1)).
>
>
> If a number, you can extract the decimal digits of the number in the same
> way, but you're not getting actual bytes (as stored by Excel). Excel
> stores numbers in an IEEE floating point standard format, the IEEE number
> of which I can't recall at the moment. All such numbers use 8 bytes for
> storage in that format. If you want the ASCII code values for the decimal
> digits of the number, use the formula above, as with text.
>
>
>
> --
> Earl Kiosterud
> mvpearl omitthisword at verizon period net
> -------------------------------------------
>
> <d_penny@usa.net> wrote in message
> news:1106943156.716897.8170@c13g2000cwb.googlegrou ps.com...
>> How would I write VBA to retrieve (get at) the value in a cell byte by
>> byte from its natural form? i.e. no conversions are to be performed.
>> E.g., if a string, then I may get more bytes than for a number.
>>
>> Thanks.
>>

>
>



 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
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
Macro to insert to move values of a cell to next cell in the same row Macro man Microsoft Applications 1 08-06-2005 04:00
Formula needed: Return cell value in a range depending on other cell values LavaDude Microsoft Applications 4 05-19-2005 20:00
How to Sum time values together correctly RompStar Microsoft Applications 5 04-28-2005 16:00
Adding time values Johnty Microsoft Applications 3 04-15-2005 20:00
Cell Values Karan Microsoft Applications 2 06-16-2004 02:10


Community Information
Options
Quick Options
Trackpads Non-Commercial Ad
Copyright Information Click to Visit
Time
Server Time
All times are GMT -4. The time now is 13:18.
Copyright
Copyright Information
The header is based off of work by Vipixel.com and modified by this site. Trackpads and the Trackpads Logo are both Registered Trademarks of Jason Edwards and cannot be used without prior written permission.  The only exception is as a link back to this site. Trackpads is a private website run by a small legion of volunteers, 3 dogs, 12.5 cats and an army of small, super smart, bio-engineered mice with pointy hats and tutu's. Search Engine Friendly URLs by vBSEO 3.2.0 RC7
Archive Links
Archive Links
Page generated in 0.95713 seconds with 19 queries