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

Hi to all,

I am trying to convert a number to a hex number using the Hex()
function in Excel but no luck !!!!
I am always getting the same error 13 datatype incompatilibity, pardon
my english, I'm french....
here is the code I use

' convertion en Hex
num = Cells(i, "T").Value
myhex = Hex(num) datatype error here
Cells(i, "U") = myhex


both of my variable are variant type and and the format of my data column
is in text, some number have letters in it
523535BA
08114572730
52204F23
08113848195
52210354


Can anyone tell me what I am doing wrong

Thanks

Alain


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Convertion to Hex

Alain,

I was looking at your code /data & wondering if you want to convert to Hex
or Decimal.
Your data is already in Hex, so i thought maybe you want to convert to
decimal.
The following macro seems to work.

===================
Dim num As String
Dim myhex As Long

num = Cells(5, "T").Value
myhex = CDec("&H" & num)
Cells(5, "U") = myhex
=======================

regards,

JohnI


"Alain" wrote in message
.. .
Hi to all,

I am trying to convert a number to a hex number using the Hex()
function in Excel but no luck !!!!
I am always getting the same error 13 datatype incompatilibity, pardon
my english, I'm french....
here is the code I use

' convertion en Hex
num = Cells(i, "T").Value
myhex = Hex(num) datatype error here
Cells(i, "U") = myhex


both of my variable are variant type and and the format of my data column
is in text, some number have letters in it
523535BA
08114572730
52204F23
08113848195
52210354


Can anyone tell me what I am doing wrong

Thanks

Alain




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Convertion to Hex

Thanks John
I just look again at my data and some of it are in Hex so I will
need to make a validator program of some sort.....
what I really need to do is to convert into an Hex and still no luck

Thanks
Alain


"JohnI in Brisbane" a écrit dans le message
de ...
Alain,

I was looking at your code /data & wondering if you want to convert to Hex
or Decimal.
Your data is already in Hex, so i thought maybe you want to convert to
decimal.
The following macro seems to work.

===================
Dim num As String
Dim myhex As Long

num = Cells(5, "T").Value
myhex = CDec("&H" & num)
Cells(5, "U") = myhex
=======================

regards,

JohnI


"Alain" wrote in message
.. .
Hi to all,

I am trying to convert a number to a hex number using the Hex()
function in Excel but no luck !!!!
I am always getting the same error 13 datatype incompatilibity,

pardon
my english, I'm french....
here is the code I use

' convertion en Hex
num = Cells(i, "T").Value
myhex = Hex(num) datatype error here
Cells(i, "U") = myhex


both of my variable are variant type and and the format of my data

column
is in text, some number have letters in it
523535BA
08114572730
52204F23
08113848195
52210354


Can anyone tell me what I am doing wrong

Thanks

Alain






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Convertion to Hex

Alain,

Your original program works perfectly for me (converting decimal to
Hexadecimal), no problems??!!

i.e. given valid data.

Perhaps you can use "On Error GoTo" to trap invalid data.

regards,

JohnI

"Alain" wrote in message
.. .
Thanks John
I just look again at my data and some of it are in Hex so I will
need to make a validator program of some sort.....
what I really need to do is to convert into an Hex and still no luck

Thanks
Alain


"JohnI in Brisbane" a écrit dans le

message
de ...
Alain,

I was looking at your code /data & wondering if you want to convert to

Hex
or Decimal.
Your data is already in Hex, so i thought maybe you want to convert to
decimal.
The following macro seems to work.

===================
Dim num As String
Dim myhex As Long

num = Cells(5, "T").Value
myhex = CDec("&H" & num)
Cells(5, "U") = myhex
=======================

regards,

JohnI


"Alain" wrote in message
.. .
Hi to all,

I am trying to convert a number to a hex number using the

Hex()
function in Excel but no luck !!!!
I am always getting the same error 13 datatype incompatilibity,

pardon
my english, I'm french....
here is the code I use

' convertion en Hex
num = Cells(i, "T").Value
myhex = Hex(num) datatype error here
Cells(i, "U") = myhex


both of my variable are variant type and and the format of my data

column
is in text, some number have letters in it
523535BA
08114572730
52204F23
08113848195
52210354


Can anyone tell me what I am doing wrong

Thanks

Alain








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
How do a kg to stone convertion in excel Michael Eastwood Excel Discussion (Misc queries) 4 December 24th 07 02:30 AM
Date convertion O.C Excel Discussion (Misc queries) 2 April 24th 06 01:45 PM
Convertion bach New Users to Excel 6 September 1st 05 07:55 PM
.wb3 file convertion rogersat Excel Worksheet Functions 0 July 18th 05 05:40 AM
CONVERTION $750 TO WORDS victory New Users to Excel 1 December 23rd 04 08:39 AM


All times are GMT +1. The time now is 11:35 AM.

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"