View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default UDF to return as text

On Fri, 11 Dec 2009 13:41:40 -0800 (PST), Fan924 wrote:

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