Question : "AC" colum has mac address if it does not have a - hyphen place one. If it already has do nothing.

Hi,

"AC" colum has mac address if it does not have a - hyphen place one. If it already has do nothing

After every 2 alphabets or no's or combination need a hyphen
000C7FP7D1CB
has to be
00-0C-7F-P7-D1-CB

Regards
Sharath

Answer : "AC" colum has mac address if it does not have a - hyphen place one. If it already has do nothing.

OK, modified to this:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
Sub InsertHypens()

    Dim i As Long
    Dim lastRow As Long
    Dim tempValue As String
    
    lastRow = Range("AC" & Rows.Count).End(xlUp).Row
    
    For i = 2 To lastRow
        tempValue = Cells(i, "AC").Value
        If tempValue <> "" And Mid(tempValue, 3, 1) <> "-" Then
            tempValue = Left(tempValue, 2) & "-" & Mid(tempValue, 3, 2) & "-" & Mid(tempValue, 5, 2) & "-" & Mid(tempValue, 7, 2) & "-" & Mid(tempValue, 9, 2) & "-" & Right(tempValue, 2)
            Cells(i, "AC").Value = tempValue
        Else
        End If
    Next i

End Sub
 
Example 2
 
Random Solutions  
 
programming4us programming4us