A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
Hi arkitek,
Welcome to the Microsoft Q&A forum.
According to your description, you would like Excel to automatically display 24'-0" when you enter 24-0.
You can use VBA to achieve this.
Step 1: Open your Excel workbook, then press Alt + F11 to open the VBA Editor.
Step 2: In the left-hand pane, under Microsoft Excel Objects, select the worksheet where you want to apply this setting.
Step 3: Paste the following VBA code into the worksheet's code window:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If IsEmpty(Target) Then Exit Sub
Application.EnableEvents = False
If InStr(Target.Value, "-") > 0 Then
Dim Arr() As String
Arr = Split(Target.Value, "-")
If UBound(Arr) = 1 Then
Target.NumberFormat = "@"
Target.Value = Arr(0) & "'-" & Arr(1) & Chr(34)
End If
End If
Application.EnableEvents = True
End Sub
Step 4: Close the VBA Editor, then try entering 24-0 to see the result.
I hope this information is helpful.
If you have any questions or need further assistance, please feel free to share them in the comments on this post so I can continue to support you.
I look forward to continuing the conversation.
If the answer is helpful, please click "Yes" and kindly upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.