Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default inserting colon into a value at a specific interval

I've got a spreadsheet with a list of alphanumeric values:

62:EF:62:EF:9C4A
62:EF:62:EF:B09B
62:EF:62:EF:A0F4
62:EF:62:EF:AF71
62:EF:62:EF:B309

I'm trying to find a way to insert a colon between the final four
characters, so that they are separated into two pairs so that the
outcome is:

62:EF:62:EF:9C:4A
62:EF:62:EF:B0:9B
62:EF:62:EF:A0:F4
62:EF:62:EF:AF:71
62:EF:62:EF:B3:09

I've used file/folder renaming utilities before that allow you to
insert or replace a value by counting so many spaces from the
beginning or the end of a value, but I don't know how to do this in
Excel. I also use the freeware ASAP utilities frequently, but don't
see a way to do this. Any suggestions?

Thanks!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default inserting colon into a value at a specific interval

Another one -

Sub Test()
Dim sFormat As String, sText As String
Dim cel As Range
Dim rng As Range

sFormat = "@@:@@:@@:@@:@@:@@"

Set rng = Selection

For Each cel In rng
sText = Replace(cel, ":", "")
cel = Format(sText, Left(sFormat, Len(sText) * 1.5))
Next

End Sub

Sub TestTheTest()
Dim i&, s$
For i = 1 To 12
s = s & Chr(64 + i)
Cells(i, 1) = s
Next
Range("A1").CurrentRegion.Select

Test
' should be OK to run Test again over processed cells
' Test
End Sub

Regards,
Peter T


wrote in message
ups.com...
I've got a spreadsheet with a list of alphanumeric values:

62:EF:62:EF:9C4A
62:EF:62:EF:B09B
62:EF:62:EF:A0F4
62:EF:62:EF:AF71
62:EF:62:EF:B309

I'm trying to find a way to insert a colon between the final four
characters, so that they are separated into two pairs so that the
outcome is:

62:EF:62:EF:9C:4A
62:EF:62:EF:B0:9B
62:EF:62:EF:A0:F4
62:EF:62:EF:AF:71
62:EF:62:EF:B3:09

I've used file/folder renaming utilities before that allow you to
insert or replace a value by counting so many spaces from the
beginning or the end of a value, but I don't know how to do this in
Excel. I also use the freeware ASAP utilities frequently, but don't
see a way to do this. Any suggestions?

Thanks!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default inserting colon into a value at a specific interval

On Jul 31, 5:01 pm, "Peter T" <peter_t@discussions wrote:
Another one -

Sub Test()
Dim sFormat As String, sText As String
Dim cel As Range
Dim rng As Range

sFormat = "@@:@@:@@:@@:@@:@@"

Set rng = Selection

For Each cel In rng
sText = Replace(cel, ":", "")
cel = Format(sText, Left(sFormat, Len(sText) * 1.5))
Next

End Sub

Sub TestTheTest()
Dim i&, s$
For i = 1 To 12
s = s & Chr(64 + i)
Cells(i, 1) = s
Next
Range("A1").CurrentRegion.Select

Test
' should be OK to run Test again over processed cells
' Test
End Sub

Regards,
Peter T

wrote in message

ups.com...

I've got a spreadsheet with a list of alphanumeric values:


62:EF:62:EF:9C4A
62:EF:62:EF:B09B
62:EF:62:EF:A0F4
62:EF:62:EF:AF71
62:EF:62:EF:B309


I'm trying to find a way to insert a colon between the final four
characters, so that they are separated into two pairs so that the
outcome is:


62:EF:62:EF:9C:4A
62:EF:62:EF:B0:9B
62:EF:62:EF:A0:F4
62:EF:62:EF:AF:71
62:EF:62:EF:B3:09


I've used file/folder renaming utilities before that allow you to
insert or replace a value by counting so many spaces from the
beginning or the end of a value, but I don't know how to do this in
Excel. I also use the freeware ASAP utilities frequently, but don't
see a way to do this. Any suggestions?


Thanks!


Thanks guys!

I went with the 2nd solution provided by Peter T. I've never worked
with VB Scripts or Macros before, so I thought it might be a nice time
to try. This worked great! The only question I have now is that now
I have two titles for Macros, "Test" and "TestTheTest". I tried
deleting parts to remedy this with no good results. Like I said, it's
working, I was just curious if there was a way to consolidate the
script into one Macro. Sorry, I'm such a huge n00b at this.

Much Appreciated!

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default inserting colon into a value at a specific interval

Get rid of 'TestTheTest'. It populates some cells with different lengths of
text, selects those cells, then runs the macro 'Test'. Ie it tests the macro
named Test with the sample data it made.

Rename the macro 'Test' to something more meaningful.
Manually select the cells you want to process
Run 'Test' or whatever new name you gave it.

One way to run the macro is with Alt-F8

I'll try and remember not to post a macro named TestTheTest again !

Regards,
Peter T

wrote in message
ups.com...
On Jul 31, 5:01 pm, "Peter T" <peter_t@discussions wrote:

I went with the 2nd solution provided by Peter T. I've never worked
with VB Scripts or Macros before, so I thought it might be a nice time
to try. This worked great! The only question I have now is that now
I have two titles for Macros, "Test" and "TestTheTest". I tried
deleting parts to remedy this with no good results. Like I said, it's
working, I was just curious if there was a way to consolidate the
script into one Macro. Sorry, I'm such a huge n00b at this.

Much Appreciated!

Another one -

Sub Test()
Dim sFormat As String, sText As String
Dim cel As Range
Dim rng As Range

sFormat = "@@:@@:@@:@@:@@:@@"

Set rng = Selection

For Each cel In rng
sText = Replace(cel, ":", "")
cel = Format(sText, Left(sFormat, Len(sText) * 1.5))
Next

End Sub

Sub TestTheTest()
Dim i&, s$
For i = 1 To 12
s = s & Chr(64 + i)
Cells(i, 1) = s
Next
Range("A1").CurrentRegion.Select

Test
' should be OK to run Test again over processed cells
' Test
End Sub

Regards,
Peter T

wrote in message

ups.com...

I've got a spreadsheet with a list of alphanumeric values:


62:EF:62:EF:9C4A
62:EF:62:EF:B09B
62:EF:62:EF:A0F4
62:EF:62:EF:AF71
62:EF:62:EF:B309


I'm trying to find a way to insert a colon between the final four
characters, so that they are separated into two pairs so that the
outcome is:


62:EF:62:EF:9C:4A
62:EF:62:EF:B0:9B
62:EF:62:EF:A0:F4
62:EF:62:EF:AF:71
62:EF:62:EF:B3:09


I've used file/folder renaming utilities before that allow you to
insert or replace a value by counting so many spaces from the
beginning or the end of a value, but I don't know how to do this in
Excel. I also use the freeware ASAP utilities frequently, but don't
see a way to do this. Any suggestions?


Thanks!


Thanks guys!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2002: Any button to insert blank rows at specific interval? Mr. Low Excel Discussion (Misc queries) 5 March 29th 09 02:51 PM
how to change colon to semi-colon in CP/List Seprator Khoshravan Excel Discussion (Misc queries) 3 February 4th 09 07:41 PM
How do you create a series based on a specific interval? Steve Hickman Excel Discussion (Misc queries) 4 July 2nd 08 01:48 PM
copying cells at a specific interval ANton Petrov Excel Programming 2 January 31st 07 01:00 AM
inserting colon xtrmhyper[_8_] Excel Programming 8 July 1st 06 07:28 PM


All times are GMT +1. The time now is 11:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"