code rectification needed

  • hi ,
    i have column A as

    i wanted all the middle part in cloumn B (excel formaula =MID(A2,5,3)) and last three parts in cloumn C (=MID(A2,9,3)).

    below code is not working for me

  • Re: code rectification needed

    Hello Libin,

    Why dont you give this code a go:

    Let me know if it works for you
    Many Thanks


  • Re: code rectification needed


    The following code might be of use if you have a large data set as it has minimal sheet interaction..

    Having said that. you didn't mention what you wanted in Column A for your output..

    If you just want to separate it all by the hyphen.. maybe this also..

    Sheets("Sheet1").Range("A1:A" & Range("A" & Rows.Count).End(xlUp).Row).TextToColumns Destination:=Range("B1"), DataType:=xlDelimited, Other:=True, OtherChar:="-"

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!