+ Reply to Thread
Results 1 to 8 of 8

VBA/Macro Code Problem

  1. #1
    Forum Contributor marc5354's Avatar
    Join Date
    11-10-2009
    Location
    India
    MS-Off Ver
    Excel 2003 & Excel 2007
    Posts
    217

    VBA/Macro Code Problem

    Hello experts,

    I having problem in in my Address book tracker, here i want to split all the data in different columns. like City Name, Address Post Code Phone Code.. I trimmed data in all respective column(s).
    Can any excellent master help me with their excellence. we need to change the code, but i don't know where to fix the problem and how. So please help me.

    Please find the attached file for your reference...

    ...Marc
    Attached Files Attached Files
    Last edited by marc5354; 05-04-2010 at 02:45 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VBA/Macro Code Problem

    I can already see the next post saying whatever solution we offer doesn't work because your data varies. Your sample sheet shows one set of data. Will ALL data sets be exactly 4 rows with name first, addresses next and phone number last? They will all be identical in layout? You sure?

    Maybe you need to update the sample data to show 4-5 samples with all variations demonstrated.

    If it's really as simple as you've shown, you may not need VBA at all, some formulas can do the work.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Contributor marc5354's Avatar
    Join Date
    11-10-2009
    Location
    India
    MS-Off Ver
    Excel 2003 & Excel 2007
    Posts
    217

    Re: VBA/Macro Code Problem

    Hello JBeaucaire,

    Yes i m sure, all datum in same order, as Name, Address, City, State, And Phone #., And finally i want to remove the duplicate data from phone number. please find the attachment.

    ...Marc
    Attached Files Attached Files

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VBA/Macro Code Problem

    In C2:
    =INDEX($B:$B, ((ROW(A1)-1)*4)+1)

    In D2:
    =INDEX($B:$B, ((ROW(A1)-1)*4)+2)

    In F2:
    =LEFT(INDEX($B:$B, ((ROW(A1)-1)*4)+3), FIND(",", INDEX($B:$B, ((ROW(A1)-1)*4)+3))-1)

    In G2:
    =RIGHT(INDEX($B:$B, ((ROW(A1)-1)*4)+3), 5)

    In H2:
    =LEFT(INDEX($B:$B, ((ROW(A1)-1)*4)+4),14)

    Now copy all those cells down until you get all your values. Delete any rows with errors at the end.

    Now copy the new columns and Edit > Paste Special > Values and you're done. You can delete the original data.

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VBA/Macro Code Problem

    You have password protected your macros in your workbook.

  6. #6
    Forum Contributor marc5354's Avatar
    Join Date
    11-10-2009
    Location
    India
    MS-Off Ver
    Excel 2003 & Excel 2007
    Posts
    217

    Re: VBA/Macro Code Problem

    Oh, i am sorry

    password is edit.

    ...Marc

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: VBA/Macro Code Problem

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  8. #8
    Forum Contributor marc5354's Avatar
    Join Date
    11-10-2009
    Location
    India
    MS-Off Ver
    Excel 2003 & Excel 2007
    Posts
    217

    Re: VBA/Macro Code Problem

    Yes boss, Problem has been fixed by you..

    Thank you very much.

    ...Marc

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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