+ Reply to Thread
Results 1 to 5 of 5

macro to wrap/unwrap text for a given range

  1. #1
    Forum Contributor
    Join Date
    10-04-2010
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    459

    macro to wrap/unwrap text for a given range

    This is my current code to unwrap text for a given range

    Please Login or Register  to view this content.
    I would like to build in a IF function to say if the given range is unwrapped (Cells.WrapTEXT = False) THEN wrap the range (Cells.WrapTEXT = True)
    i.e. everytime the macro button is clicked it will wrap and unwrap the data range
    Last edited by Gti182; 03-26-2014 at 09:21 AM.

  2. #2
    Forum Expert Ron Coderre's Avatar
    Join Date
    03-22-2005
    Location
    Boston, Massachusetts
    MS-Off Ver
    2013, 2016, O365
    Posts
    6,996

    Re: macro to wrap/unwrap text for a given range

    Will ALL of the referenced cells ALWAYS have the same wrap settings (all-wrapped...none-wrapped)?
    Ron
    Former Microsoft MVP - Excel (2006 - 2015)
    Click here to see the Forum Rules

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: macro to wrap/unwrap text for a given range

    Try this...

    Please Login or Register  to view this content.
    EDIT: ...if "yes" to Ron's question.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Forum Contributor
    Join Date
    10-04-2010
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    459

    Re: macro to wrap/unwrap text for a given range

    yes they will all be consistently formatted i.e. all wrapped or all unwrapped

  5. #5
    Forum Contributor
    Join Date
    10-04-2010
    Location
    London
    MS-Off Ver
    Office 365
    Posts
    459

    Re: macro to wrap/unwrap text for a given range

    AlphaFrog that works great! thanks

  6. #6
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: macro to wrap/unwrap text for a given range

    Try:
    Please Login or Register  to view this content.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

+ 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] Wrap Text in ListView: how to wrap text in the columns of a list view
    By TommyToe in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-05-2012, 07:02 AM
  2. VBA to unwrap text in all cells
    By dagindi in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-05-2010, 02:07 AM
  3. Text wrap and allow cell height to increase with wrap
    By tpenterprize in forum Excel General
    Replies: 1
    Last Post: 10-19-2007, 02:30 PM
  4. shortcut toolbar to wrao/unwrap text
    By ceemo in forum Excel General
    Replies: 1
    Last Post: 11-15-2006, 04:20 PM
  5. [SOLVED] How do I unwrap text to columns?
    By ChristineR in forum Excel General
    Replies: 2
    Last Post: 12-09-2005, 11:50 AM

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