+ Reply to Thread
Results 1 to 6 of 6

How to use VBA to insert carriage returns in cells on a Mac?

  1. #1
    Registered User
    Join Date
    07-11-2009
    Location
    South Gippsland, Australia
    MS-Off Ver
    Excel 2011 (Mac)
    Posts
    31

    How to use VBA to insert carriage returns in cells on a Mac?

    I'm trying to export data from a database management package to Excel. I can create a text file containing the data but data cells which contain carriage returns won't import properly into Excel. I can change each CR to a text string like "#$#" and I then want a VBA macro which changes each "#$#" back to a CR. A CR in a cell in Excel on a Mac is 'control-option-enter'. How do I weave that into a replacement string?

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,580

    Re: How to use VBA to insert carriage returns in cells on a Mac?

    Try using vbcr, vblf, or vbcrlf. Or Chr(10) or Chr(13).
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    07-11-2009
    Location
    South Gippsland, Australia
    MS-Off Ver
    Excel 2011 (Mac)
    Posts
    31

    Re: How to use VBA to insert carriage returns in cells on a Mac?

    Thanks TMS, the vbcr works fine. I saved my Excel file in a .xlsm format and now, every time I open it, I have a yellow banner across the top that says, "Security warning Data connections have been disabled." How do I get rid of that?

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,580

    Re: How to use VBA to insert carriage returns in cells on a Mac?

    You're welcome.

    This
    "Security warning Data connections have been disabled." How do I get rid of that?
    sounds like a different question. I can only guess that somewhere along the line the saved workbook has links to another file. But I don't know anything about Macs so I'd suggest you start a new thread with the new question.

    If vbcr answers the original question, then this thread should be marked "Solved"

  5. #5
    Registered User
    Join Date
    07-11-2009
    Location
    South Gippsland, Australia
    MS-Off Ver
    Excel 2011 (Mac)
    Posts
    31

    Re: How to use VBA to insert carriage returns in cells on a Mac?

    Thank you - it is solved but I can't see a 'Solved' button anywhere on the page.

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,580

    Re: How to use VBA to insert carriage returns in cells on a Mac?

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Remove carriage returns from end of text in cells on worksheet
    By welchs101 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-15-2015, 02:19 PM
  2. WordVBA- Search doc- insert 8 carriage returns if text in line
    By sbktex in forum Word Programming / VBA / Macros
    Replies: 3
    Last Post: 09-17-2014, 09:20 PM
  3. EntireRow.AutoFit Not Always Working When Manual Carriage Returns in my Cells
    By zfeinstein in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-06-2013, 03:59 PM
  4. Replies: 1
    Last Post: 04-08-2010, 05:16 PM
  5. [SOLVED] Concatenate cells with carriage returns
    By Rob in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-03-2005, 02:05 PM
  6. Carriage returns
    By tracyt620 in forum Excel General
    Replies: 1
    Last Post: 07-07-2005, 09:52 AM
  7. [SOLVED] Inserting carriage returns in Excel cells
    By Alyce in forum Excel General
    Replies: 3
    Last Post: 02-15-2005, 06:45 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