View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Joseph[_15_] Joseph[_15_] is offline
external usenet poster
 
Posts: 1
Default formatting for feet and inches

Hi Tim,

I just wasn't happy with what I gave you so here's something more
solid. In the VBE go to worksheet one and pick Selection Change. Put
this code in:

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Application.OnKey "~", "macro1"
Application.OnKey "{ENTER}", "macro1"
End Sub

Then create a macro called macro1 and Put this code into it:

Sub Macro1()
mystring = ActiveCell.Value
If Len(mystring) < 1 Then End
If InStr(mystring, " ") < 1 Then End
Position = InStr(mystring, " ")
newstring = Left(mystring, (Position - 1)) & """" & Right(mystring, 2)
& "'"
ActiveCell.Value = newstring
End Sub

Now go into your worksheet and put a value of format "number space
number" into any cell and press either enter key.
I assume all a user is going to do when they enter the value is either
press numeric enter or normal enter. Thats all this code allows for
(haven't figured the click event yet). If anyone knows how to improve
on this I would be most grateful!

Hope this is better for you Tim!


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