Results 1 to 14 of 14

Number inserted in the middle of the text.

Threaded View

abjac Number inserted in the middle... 09-28-2014, 06:47 AM
PCI Re: Number inserted in the... 09-28-2014, 07:24 AM
AlphaFrog Re: Number inserted in the... 09-28-2014, 07:25 AM
abjac Re: Number inserted in the... 09-28-2014, 07:41 AM
PCI Re: Number inserted in the... 09-28-2014, 07:59 AM
abjac Re: Number inserted in the... 09-28-2014, 08:04 AM
PCI Re: Number inserted in the... 09-28-2014, 08:12 AM
abjac Re: Number inserted in the... 09-28-2014, 10:49 AM
PCI Re: Number inserted in the... 09-28-2014, 11:05 AM
PCI Re: Number inserted in the... 09-28-2014, 11:13 AM
abjac Re: Number inserted in the... 09-28-2014, 11:45 AM
abjac Re: Number inserted in the... 09-28-2014, 12:12 PM
PCI Re: Number inserted in the... 09-28-2014, 06:19 PM
abjac Re: Number inserted in the... 09-29-2014, 12:47 AM
  1. #1
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Number inserted in the middle of the text.

    HI I solved this earlier today but had a extra question.

    I got this code from PCI earlier and it solved my problem. But i would like to have the code moderated so it can also change below if i insert new files. So what ever the input is it have to insert the number.

    The input could look like this
    C:\Documents and Settings\Alancecille\Desktop\torrents\Karaoke songs\ 0001 - Georgia Satellites - Keep Your Hands To Yourself.zip
    C:\Documents and Settings\Alancecille\Desktop\torrents\Karaoke songs\ tmsjek - Ig Joe Turner - Shake Rattle & Roll.zip
    C:\Documents and Settings\Alancecille\Desktop\torrents\Karaoke songs\ 0003 - Jerry Lee Lewis - Great Balls Of Fire.zip
    C:\Documents and Settings\Alancecille\Desktop\torrents\Karaoke songs\ 0004 - Jimmy Buffett - Margaritaville.zip
    C:\Documents and Settings\Alancecille\Desktop\torrents\Karaoke songs\ nenm5 - Otis Day & The Knights - Shout.zip
    C:\Documents and Settings\Alancecille\Desktop\torrents\Karaoke songs\ 0006 - Ray Charles - Hit The Road Jack.zip
    C:\Documents and Settings\Alancecille\Desktop\torrents\Karaoke songs\ 0007 - Sly & The Family Stone - Dance To The Music.zip
    C:\Documents and Settings\Alancecille\Desktop\torrents\Karaoke songs\ 0008 - Stray Cats - Rock This Town.zip
    So what ever i do it will make the order with 4 digits in upper example it will replace tmsjek with 0002
    and replace nenm5 with 0005. In this way i can always insert new files and make them in order.

    This is the code working but it will now delete the old. if i run it now it will keep the 0006 and add one more.

    Please have a look thanks

    Sincerely

    Abjac

    Sub Treat()
    Sheets(1).Activate
    Dim WkRg  As Range
    Dim F  As Range
    Dim I  As Long, IStg As String
    Dim LStg  As String, RStg  As String
        Application.ScreenUpdating = False
        Set WkRg = Range(Cells(2, "B"), Cells(Rows.Count, "B").End(xlUp))
        For Each F In WkRg
            I = I + 1
            IStg = Format(I, " 0000 ")
            LStg = Left(F, InStrRev(F, "\"))
            RStg = Right(F, Len(F) - InStrRev(F, "\"))
            F.Value = LStg & IStg & RStg
        Next F
        Application.ScreenUpdating = True
    End Sub
    Last edited by abjac; 09-28-2014 at 06:50 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Number need to inserted in the middle of text string in cell in one column
    By abjac in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-28-2014, 04:51 AM
  2. [SOLVED] how to insert zero in the middle of combination text and number
    By zieana in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-07-2013, 10:05 PM
  3. reference to number, inserted into text?
    By bksmu in forum Excel General
    Replies: 5
    Last Post: 09-20-2011, 01:12 AM
  4. [SOLVED] a number is replaced by text when inserted anywhere in the sheet
    By Marga in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-26-2005, 01:05 PM
  5. a number is replaced by text when inserted anywhere in the sheet
    By Marga in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-24-2005, 08:05 PM

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