Custom Number Format including Text
Closed
Excel Newbie
-
Apr 5, 2012 at 06:40 AM
aquarelle Posts 7140 Registration date Saturday April 7, 2007 Status Moderator Last seen March 25, 2024 - Apr 5, 2012 at 01:07 PM
aquarelle Posts 7140 Registration date Saturday April 7, 2007 Status Moderator Last seen March 25, 2024 - Apr 5, 2012 at 01:07 PM
Related:
- Custom Number Format including Text
- Ultimate custom night - Download - Horror
- Format factory - Download - Other
- Custom resolution utility - Download - Customization
- Dino game custom character - Guide
- Kingston format utility - Download - Storage
1 response
aquarelle
Posts
7140
Registration date
Saturday April 7, 2007
Status
Moderator
Last seen
March 25, 2024
491
Apr 5, 2012 at 01:07 PM
Apr 5, 2012 at 01:07 PM
Hi,
You can use this formula into an other column (adapt it for your data) :
=LEFT(A1,5)&"-"&MID(A1,6,5)&"-"&RIGHT(A1,3)
or you can use a vba macro, if you know how to use it like this :
Best regard
You can use this formula into an other column (adapt it for your data) :
=LEFT(A1,5)&"-"&MID(A1,6,5)&"-"&RIGHT(A1,3)
or you can use a vba macro, if you know how to use it like this :
Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) Dim Cible As Range, Cible_2 As String If Not Intersect(Target, Range(Range("A1"), Range("A1").End(xlDown))) Is Nothing Then Set Cible = Target If Len(Cible) = 0 Then Exit Sub If Len(Cible) <> 13 Then Cible_2 = Application.WorksheetFunction.Substitute(Cible, "-", "") If Len(Cible_2) = 13 Then Exit Sub Cible.ClearContents Cible.Activate MsgBox "You should type 13 characters." Else Target = Left(Cible, 5) & "-" & Mid(Cible, 6,5) & "-" & Right(Cible, 3) End If End If End Sub
Best regard