Custom Number Format including Text
Closed
                                    
                        Excel Newbie                    
                                    -
                            Apr  5, 2012 at 06:40 AM
                        
aquarelle Posts 7435 Status Moderator - Apr 5, 2012 at 01:07 PM
        aquarelle Posts 7435 Status Moderator - Apr 5, 2012 at 01:07 PM
        Related:         
- Custom Number Format including Text
- Ultimate custom night download - Download - Horror
- Custom bitly - Guide
- Custom resolution utility - Download - Customization
- Kingston format utility - Download - Storage
- Dvi format - Guide
1 response
                        
                    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
