UDF to return as text

F

Fan924

This UDF returns a Hex number. I would like it to change the cell
format to text. Thanks,

Public Function DecToHex(DecNumber As Variant) As String
DecToHex = Right("0" & Hex(DecNumber), 2)
End Function
 
R

Ron Rosenfeld

This UDF returns a Hex number. I would like it to change the cell
format to text. Thanks,

Public Function DecToHex(DecNumber As Variant) As String
DecToHex = Right("0" & Hex(DecNumber), 2)
End Function

A Function can only return a value. It cannot change the environment.
--ron
 

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