LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Hexadecimal Numbers

I'm writing a VBA "macro" which reads several text files and combines
data from them into a single spreadsheet.

One column must contain a value which is normally expressed in
hexadecimal. The value is represented in one of the input files as a
four-character string in which the characters are all members of the set
"0123456789ABCDEF". Leading zeroes are possible. I need to put that
character string in the cells of one column in the spreadsheet.

Initially, I tried setting NumberFormat property of the cells to "0000".
This worked except for those values which contain a single "E" preceded
and followed by digits. In this case Excel interprets the string as a
number with an exponent and displays the wrong value.

Now I've changed it to set the NumberFormat property to "@". Now all of
the values are displayed correctly but those which contain only digits
(i.e. those which Excel thinks are numbers) are flagged with a little
triangle in the upper left corner and, when clicked, display an warning
message that the cell contains a "number formatted as text."

I can get rid of that by manually selecting "Ignore Error" from the menu
but I haven't found a way to automate that.

Can anyone suggest a way to store (in VBA) a string of hexadecimal
digits in a cell and have the result appear exactly as stored with
leading zeroes if present, non-numeric characters "ABCEDF" if present,
and no warning flag?
--
Norm

To reply, change domain to an adult feline.

 
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
Import hexadecimal data into excel keeping hexadecimal format Whale Excel Discussion (Misc queries) 1 February 24th 10 08:23 AM
Format cells for hexadecimal numbers Ricsastir Excel Discussion (Misc queries) 2 December 10th 09 11:38 AM
How can I automatically decrement a column in hexadecimal numbers Bonk33r Excel Discussion (Misc queries) 4 August 7th 06 06:59 PM
I want to convert a column of hexadecimal numbers to decimal num xs2sandeep Excel Discussion (Misc queries) 2 April 4th 06 09:46 AM
adding hexadecimal numbers Dave New Users to Excel 3 February 10th 06 08:46 AM


All times are GMT +1. The time now is 11:16 PM.

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

About Us

"It's about Microsoft Excel"