Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-29-2014, 08:20 AM
auriuman78 auriuman78 is offline Macro to add periods into MAC address lists Windows 7 64bit Macro to add periods into MAC address lists Office 2010 64bit
Novice
Macro to add periods into MAC address lists
 
Join Date: Jan 2014
Posts: 1
auriuman78 is on a distinguished road
Default Macro to add periods into MAC address lists

I have a time consuming task of adding the MAC separator periods into a scanned list of MAC addresses. It is a requirement that I add the periods and am currently doing it manually. I know there are macros to automate things and I've made some using the record feature but I don't think that's going to cut it for this task. I'm thinking this is going to require VBA and I have pretty much no knowledge of VBA, the closest would be old school BASIC.



If there's a better way to do this task than manually I'd love some pointers and help. Thanks in advance!


EDIT:
The format of the document, depending on how many addresses I'm scanning in, is generally in three or four columns using the table function, so it looks like this:

0090c2e4e993 0090c2e8844f 0090c2e77aa9 0090c2f43de4
0090c2e66790 0090c2e03e4e 0090c2d45fe3 0090c2edd334


These need the periods inserted. The forum removes the spacing between columns so imagine a bit more spacing between them.
Reply With Quote
  #2  
Old 01-29-2014, 10:30 AM
gmaxey gmaxey is offline Macro to add periods into MAC address lists Windows 7 32bit Macro to add periods into MAC address lists Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,427
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

Provided each cell has 12 characters, this (while crude) should work:

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oTbl As Word.Table
Dim oCell As Cell
Set oTbl = Selection.Tables(1)
  For Each oCell In oTbl.Range.Cells
    If Len(oCell.Range.Text) = 14 Then
      oCell.Range.Characters(5).InsertBefore "."
      oCell.Range.Characters(10).InsertBefore "."
    End If
  Next
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shared file\macro & IP address ibrahimaa Excel Programming 0 01-29-2012 09:08 AM
Auto Forward Emails - Specific Time Periods Only Dav Outlook 0 06-22-2011 12:03 PM
Macro to replace From Address in Outlook RlcZek113524 Outlook 0 06-08-2011 02:20 PM
HELP! Outlook 2003 Address Books - multiple account address lists ukmonkeynuts Outlook 0 06-01-2011 06:18 AM
Putting periods/dots around the letter A ph3iron Word 0 03-27-2010 06:11 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:56 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft