View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Sandy V[_6_] Sandy V[_6_] is offline
external usenet poster
 
Posts: 37
Default Can you implement a custom format with VB code?

What's your external switch?

In this eg I've assumed you change a cell named "units"
and a defined range named "mmIn" of one or more cells for
your custom formats:

in the Worksheet module

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

If Not Intersect(Target, Range("units")) Is Nothing Then
If Range("units") = "mm" Then
Range("mmIn").NumberFormat = "_-""mm""* #,##0"
Else
Range("mmIn").NumberFormat = "_-""inch""* #,##0.00"
End If
End If

End Sub

Regards,
Sandy
-----Original Message-----
What I want to do is have numbers entered in cells that

represent
lengths in milimeters. I want to have a custom format

that displays the
numbers in either milimeters or inches depending on an

external switch.


---
Message posted from http://www.ExcelForum.com/

.