![]() | ![]() | ![]() |
| |||||||
| Forums | Register | Groups | Awards | Arcade | Pets | T-Bucks / T-Store | Invite Your Friends | Blogs | Mark Forums Read |
| Microsoft Applications Discussions about Windows and other MS Products such as Office |
![]() |
| | LinkBack | Thread Tools |
| | #1 (permalink) |
| Civilians | 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. |
|
| | #2 (permalink) |
| Civilians | 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. > |
|
| | #3 (permalink) |
| Civilians | 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. > |
|
| | #4 (permalink) |
| Civilians | 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. >> > > |
|
![]() |
| Bookmarks |
| Thread Tools | |
| |
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 |
![]() | ![]() | ![]() |