Split cells in excel using VBA

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • loudey
    New Member
    • Mar 2010
    • 20

    Split cells in excel using VBA

    I'm trying to split a product code into multiple cells but i'm not sure how to go about it. here is an example

    (the product code is in A1)

    A1=MST5F2

    Here is what i want the output to look like

    B1=MST
    C1=5
    D1=F
    E1=2

    so B1 will always be the first three digits and then beyond that it's 1 digit in every column the product code is always 6 digits.
  • MikeTheBike
    Recognized Expert Contributor
    • Jun 2007
    • 640

    #2
    Hi

    B1=LEFT(A1,3)
    C1=MID(A1,4,1)
    D1=MID(A1,5,1)
    E1=MID(A1,6,1)
    or
    E1=RIGHT(A1,1)

    HTH


    MTB

    Comment

    • Guido Geurs
      Recognized Expert Contributor
      • Oct 2009
      • 767

      #3
      dear,

      I hope this will help (see attachment)

      br,
      Attached Files

      Comment

      • loudey
        New Member
        • Mar 2010
        • 20

        #4
        thanks a lot guys this, both solutions works. highly appreciated.

        Comment

        Working...