+ Reply to Thread
Results 1 to 17 of 17

Have colons inserted into MAC address automatically.

  1. #1
    Registered User
    Join Date
    06-22-2021
    Location
    Virginia
    MS-Off Ver
    365
    Posts
    10

    Have colons inserted into MAC address automatically.

    I need to be able to paste a MAC address into a column/cell and have it automatically insert the colon, then I need to be able to copy the MAC address and not the Formula.

    Example
    A0B1C2D3E4F5 needs to be A0:B1:C2:D3:E4:F5

    FYI MAC addresses are always 12 characters long.

    Thank You
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,938

    Re: Have colons inserted into MAC address automatically.

    The attached has event code that will change any 12 character entry in column A into a MAC address.
    Attached Files Attached Files
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    06-22-2021
    Location
    Virginia
    MS-Off Ver
    365
    Posts
    10

    Re: Have colons inserted into MAC address automatically.

    Thank You. it works great if I just paste 1 at a time. Is there any way to have it if I copy a 2-2000 it will switch them all?

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,938

    Re: Have colons inserted into MAC address automatically.

    Of course. Change the event code to this:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    06-22-2021
    Location
    Virginia
    MS-Off Ver
    365
    Posts
    10

    Re: Have colons inserted into MAC address automatically.

    Great job!! Almost Perfect.

    If the MAC begins with 00 (002313215614) it shows up as 2313215614. Not 00:23:13:21:56:14

  6. #6
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,938

    Re: Have colons inserted into MAC address automatically.

    The code works fine for me in those cases. Try formatting your base column as "General" or as "Text" rather than as number.

  7. #7
    Registered User
    Join Date
    06-22-2021
    Location
    Virginia
    MS-Off Ver
    365
    Posts
    10

    Re: Have colons inserted into MAC address automatically.

    Your right. I have the column set to text but some times it switches the cell to General when I post 00 in it. But I have it working.

    Cannot Thank You enough!!!!

  8. #8
    Forum Expert BMV's Avatar
    Join Date
    01-13-2020
    Location
    St-Petersburg, Russia
    MS-Off Ver
    2013-2016
    Posts
    1,329

    Re: Have colons inserted into MAC address automatically.

    Please Login or Register  to view this content.
    Last edited by BMV; 01-05-2022 at 01:36 AM.

  9. #9
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,938

    Re: Have colons inserted into MAC address automatically.

    If you want it to work with any formatting, you could modify the code to this - works with any number of leading 0s

    Please Login or Register  to view this content.
    Last edited by Bernie Deitrick; 01-05-2022 at 09:49 AM.

  10. #10
    Forum Expert BMV's Avatar
    Join Date
    01-13-2020
    Location
    St-Petersburg, Russia
    MS-Off Ver
    2013-2016
    Posts
    1,329

    Re: Have colons inserted into MAC address automatically.

    @Bernie Deitrick Target.Value = Left( ?????? there must be c.Value i mean.

  11. #11
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,938

    Re: Have colons inserted into MAC address automatically.

    strNew is created using c.Value, then padded to the left with any needed leading 0s and colons.

  12. #12
    Forum Expert BMV's Avatar
    Join Date
    01-13-2020
    Location
    St-Petersburg, Russia
    MS-Off Ver
    2013-2016
    Posts
    1,329

    Re: Have colons inserted into MAC address automatically.

    @Bernie Deitrick i speak about
    Please Login or Register  to view this content.
    that must be
    Please Login or Register  to view this content.
    how ewer my #8 easy

  13. #13
    Forum Expert
    Join Date
    12-09-2014
    Location
    Trakai, Lithuania
    MS-Off Ver
    2016
    Posts
    1,287

    Re: Have colons inserted into MAC address automatically.

    Formula
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Attached Files Attached Files

  14. #14
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,938

    Re: Have colons inserted into MAC address automatically.

    Doh! Thanks - I fixed my clearly brain-addled post

  15. #15
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,938

    Re: Have colons inserted into MAC address automatically.

    Sorry - clearly I need more coffee!

  16. #16
    Forum Expert BMV's Avatar
    Join Date
    01-13-2020
    Location
    St-Petersburg, Russia
    MS-Off Ver
    2013-2016
    Posts
    1,329

    Re: Have colons inserted into MAC address automatically.

    for old excel
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    or
    Formula: copy to clipboard
    Please Login or Register  to view this content.

    but to be sure then 12 characters in place
    =REPLACE ( REPLACE ( REPLACE ( REPLACE (REPLACE ( RIGHT(REPT(0;12)&A2;12);11; ;":");9; ;":");7; ;":");5; ;":");3; ;":")
    Last edited by BMV; 01-05-2022 at 10:31 AM.

  17. #17
    Forum Expert
    Join Date
    12-09-2014
    Location
    Trakai, Lithuania
    MS-Off Ver
    2016
    Posts
    1,287

    Re: Have colons inserted into MAC address automatically.

    Power Query
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Formula to pull out specific values in between two colons of several colons
    By Miskondukt in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-02-2017, 10:51 AM
  2. Static time that is automatically inserted
    By rod50 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-18-2013, 06:59 PM
  3. Need values to be automatically inserted
    By Francoise in forum Excel - New Users/Basics
    Replies: 5
    Last Post: 09-09-2011, 07:42 PM
  4. How to have rows automatically inserted with the tab key
    By friend11_6 in forum Excel General
    Replies: 0
    Last Post: 07-19-2009, 09:02 PM
  5. Replies: 1
    Last Post: 07-12-2006, 11:25 AM
  6. [SOLVED] insert colons in time automatically when input to cell
    By Mike in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-12-2006, 09:30 PM
  7. automatically go to last worksheet inserted in a workbook.
    By darkcity1965 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-28-2005, 12:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1