Closed Thread
Results 1 to 9 of 9

Visual Basic_Macro problem

  1. #1
    Registered User
    Join Date
    02-21-2008
    Location
    Bloomfield, CT
    Posts
    5

    Visual Basic_Macro problem

    Hey there all you programmers! I'm a novice who's trying to get a macro to work. I got the code for the macro on this forum, previously. It's purpose is to take a cell with a carriage return and split the data into multiple successive cells. In other words, "Name(CR)Address" in one cell will become 2 cells--Cell 1: Name / Cell 2: Address.
    Here's the code:


    Please Login or Register  to view this content.
    My problem is, when I run the macro I'm getting a Compile error: Sub or function not defined.

    What am I doing wrong? Or more appropriately, what am I doing?

    Thanks all.
    --KKL
    Last edited by VBA Noob; 05-22-2008 at 02:24 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    kkl, please read the Forum Rules about thread titles, and then edit your thread title to be descriptive of your problem.

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,671
    The code compiled for me; however, your example states that you have only two values separated by a "CR". The Split function will return a two element array with the count starting at 0 (0,1). Your For..Next loop, though, counts 0,1,2, the '2' being a third and none existent element, so the macro crashes.
    Last edited by royUK; 05-23-2008 at 02:50 AM.
    Ben Van Johnson

  4. #4
    Forum Contributor
    Join Date
    03-25-2008
    MS-Off Ver
    Excel, Outlook, Word 2007/2003
    Posts
    245
    Please Login or Register  to view this content.
    Charlize
    Last edited by Charlize; 05-23-2008 at 05:14 AM.

  5. #5
    Registered User
    Join Date
    02-21-2008
    Location
    Bloomfield, CT
    Posts
    5

    Question Still erroring

    Thanks, but I'm still getting the same error when I use the new code. Any suggestions?

  6. #6
    Forum Contributor
    Join Date
    03-25-2008
    MS-Off Ver
    Excel, Outlook, Word 2007/2003
    Posts
    245
    My coding works just fine for my. Give a sample workbook with worksheet filled in.

    Charlize

  7. #7
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    kkl

    You have been asked by shg to read the forum rules & change your thread title

    Do Not Ignore A Moderates Request

    If you do ingnore their requests you may find your threads closed or even worse you may be banned for a period of time
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  8. #8
    Registered User
    Join Date
    02-21-2008
    Location
    Bloomfield, CT
    Posts
    5

    Here's my sample data.

    Thanks for the help!
    Attached Files Attached Files

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    kkl, that's two requests you've ignored.

    If you wish to continue, please read the forum rules, then start a new thread with a descriptive title.

    Thanks.

Closed 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