Importing HEX data

G

Google

I need to import an array of 4-digit HEX values from an ASCII text
file.
Excel treats any of the 0E... values as a numerical value with
exponential format.

Using the import wizard I declared the data as 'Text' rather than the
default 'general' but it doesn't change Excel's mind about those 0E's.

I am using Excel 2000 under windows 2000 on a PC.

Thanks for any help.

-Ralph
 
J

Jim Rech

I imported the follow 'hex' data into Excel using the Text Import wizard,
specifying that the data was comma delimited and each of the 4 fields was
text:

0001,00e2,000a,0009

It came in fine. What are you doing differently?

--
Jim
|I need to import an array of 4-digit HEX values from an ASCII text
| file.
| Excel treats any of the 0E... values as a numerical value with
| exponential format.
|
| Using the import wizard I declared the data as 'Text' rather than the
| default 'general' but it doesn't change Excel's mind about those 0E's.
|
| I am using Excel 2000 under windows 2000 on a PC.
|
| Thanks for any help.
|
| -Ralph
|
 
G

Google

I imported the follow 'hex' data into Excel using the Text Import wizard,
specifying that the data was comma delimited and each of the 4 fields was
text:

0001,00e2,000a,0009

It came in fine. What are you doing differently?
<snipped my original post>

Jim thanks for the reply.
You are correct, the data does import correctly, I performed a step
immediately after importing that causes the problem, sorry for the
error. I discovered the problem this morning and didn't recall what I
did late last night until too late.

I imported text in two letter pairs, separated by a space, like:

01 4C 25 E7 ...

When I import it I group two pairs together so the contents of a
single cell would be:
01 4C or 25 E7 (Using the fixed width option)

After importing, I removed the space between the pairs using a replace
command, replacing the space char with nothing.

It's at that point that the value is 'corrupted'.

I formatted the cells as text prior to the 'replace' action but it
doesn't help.

Thanks for the help.

-Ralph
 
J

Jim Rech

I formatted the cells as text prior to the 'replace'

The Replace command is most annoying in that way. I can only suggest that
you remove the space with a macro. An example that works on the selected
range:

Sub RemoveSpace()
Dim CellStr As String
Dim Cell As Range
For Each Cell In Selection
CellStr = Cell.Value
CellStr = Replace(CellStr, " ", "")
Cell.NumberFormat = "@"
Cell.Value = CellStr
Next
End Sub



--
Jim
| > I imported the follow 'hex' data into Excel using the Text Import
wizard,
| > specifying that the data was comma delimited and each of the 4 fields
was
| > text:
| >
| > 0001,00e2,000a,0009
| >
| > It came in fine. What are you doing differently?
| <snipped my original post>
|
| Jim thanks for the reply.
| You are correct, the data does import correctly, I performed a step
| immediately after importing that causes the problem, sorry for the
| error. I discovered the problem this morning and didn't recall what I
| did late last night until too late.
|
| I imported text in two letter pairs, separated by a space, like:
|
| 01 4C 25 E7 ...
|
| When I import it I group two pairs together so the contents of a
| single cell would be:
| 01 4C or 25 E7 (Using the fixed width option)
|
| After importing, I removed the space between the pairs using a replace
| command, replacing the space char with nothing.
|
| It's at that point that the value is 'corrupted'.
|
| I formatted the cells as text prior to the 'replace' action but it
| doesn't help.
|
| Thanks for the help.
|
| -Ralph
|
 
G

Google

The Replace command is most annoying in that way. I can only suggest that
you remove the space with a macro. An example that works on the selected
range:

Sub RemoveSpace()
Dim CellStr As String
Dim Cell As Range
For Each Cell In Selection
CellStr = Cell.Value
CellStr = Replace(CellStr, " ", "")
Cell.NumberFormat = "@"
Cell.Value = CellStr
Next
End Sub

Thanks very much for the sugestion, I will incorporate a macro. I had
to write a macro to take my 8 by N array of values and put them into a
single column so I could easily graph the data anyway.
Thanks for taking the time to write the macro, it's very helpful for
me as I am Visual Basic challenged.

-Ralph
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top