+ Reply to Thread
Results 1 to 6 of 6

Compressing columns

  1. #1
    Registered User
    Join Date
    11-01-2014
    Location
    Australia
    MS-Off Ver
    2007
    Posts
    17

    Compressing columns

    Hi guys,

    I have a problem that I'm not sure how to deal with. My data looks like that in the left table (see Attached), And I want to compress the columns by removing blank spaces (see Attached), hopefully I would end up with just one final column, but i need to be able to make sure that if there is 2 or more data on the same row, that they don't overwrite each other.


    Thanks Guys
    Attached Files Attached Files
    Last edited by ExcelJWS; 04-22-2016 at 01:46 PM. Reason: Adding attachment

  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,630

    Re: Compressing columns

    Post a sample workbook. The forum removes excess spaces so your example doesn't work well in explaining your requirement.
    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
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: Compressing columns

    I did a quick try,

    This shift the data over once, but not quite right.

    I think you need to evaluate each row first to find the last used cell to move to. Or maybe there's a better way? Or maybe loop the For Each for the number of columns you have so it runs multiple times.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Compressing columns

    The attached code works on the attached sample.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    11-01-2014
    Location
    Australia
    MS-Off Ver
    2007
    Posts
    17

    Re: Compressing columns

    Im looking at your code, trying to understand ti so I can adapt it to my workbook.

    what does "&" do?

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Compressing columns

    It is short name for a long

    k& means k as long

+ 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. Compressing Images
    By benkingery in forum Excel General
    Replies: 1
    Last Post: 08-25-2010, 10:50 PM
  2. Compressing an array
    By JXBlack in forum Excel General
    Replies: 2
    Last Post: 09-05-2009, 03:07 AM
  3. Auto-compressing specific columns when using AutoFilter
    By Cheshire in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-19-2008, 07:20 PM
  4. Compressing List
    By MaddHatta in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-28-2008, 03:39 PM
  5. Compressing Images in XL 08 MAC
    By evan4498 in forum Excel General
    Replies: 0
    Last Post: 09-04-2008, 12:39 PM
  6. Compressing data
    By Michelle_Man in forum Excel General
    Replies: 0
    Last Post: 06-13-2007, 10:45 PM
  7. [SOLVED] compressing folders
    By Chris in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-17-2006, 05:00 PM
  8. [SOLVED] compressing files
    By tnance in forum Excel General
    Replies: 5
    Last Post: 12-18-2005, 11:40 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