View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein Rick Rothstein is offline
external usenet poster
 
Posts: 5,934
Default Setting cell format based on format codes

If I understand your request correctly, this macro should do what you
want...

Sub ApplyFormats()
Dim C As Range
For Each C In Range("G14:G36")
C.Offset(0, 2).NumberFormat = C.Value
Next
End Sub

--
Rick (MVP - Excel)


"Hans Knudsen" wrote in message
...
I have some format codes in G14:G36 like:
G14: #.##0..
G15: _(* #.##0_);_(* (#.##0);_(* "-"_);_(@_)
G16: "+45"## ## ## ##
etc.

and would like a macro that can take the format codes in G14:G36 and
create these formats in cells I14:I36.

Will someone help me?

Regards
Hans Knudsen