+ Reply to Thread
Results 1 to 6 of 6

How to move data to the left most field

  1. #1
    Registered User
    Join Date
    04-23-2010
    Location
    DC
    MS-Off Ver
    Excel 2003
    Posts
    7

    How to move data to the left most field

    I have a spreadsheet that looks like this:

    Invoice # Item Code #1 Item Code #2 Item Code #3 Etc Etc

    1 1 5 9
    2 66 47
    3
    4 5
    5 47 66
    6 5 7
    7
    8
    9
    10 5


    The numbers are different, but is there an easy way to move any field with a character in it to the left as far as it will go. I want it to look like this when finished:

    Invoice # Item Code #1 Item Code #2 Item Code #3 Etc Etc

    1 1 5 9
    2 66 47
    3
    4 5
    5 47 66
    6 5 7
    7
    8
    9
    10 5


    Any help would be great,

    Thanks in advance,

    Chad

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: How to move data to the left most field

    Your example doesn't help because as you can see they are identical. Perhaps select the range and try this,:
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-23-2010
    Location
    DC
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: How to move data to the left most field

    Sorry- formating got the bast of that thread. Here is an .xls file on Sheet 1 is how my data comes, Sheet 2 is how I want it to look. Is there any easy way through excel or a macro I could use. In my real data pool I will have more columns and many more rows.

    Thanks in advance,

    Chad
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    03-11-2010
    Location
    India
    MS-Off Ver
    2010
    Posts
    268

    Re: How to move data to the left most field

    1. loop through each row (until last used row)
    2. have another nested loop inside this loop to looop through each column. (This way you loop through each used cell in the excel file)
    3. if a cell is blank, check upto two cells (or whatever no. of cols) to its right.
    4. If you find any data in these cells, cut -paste to current cell.

    hth
    Ajay

  5. #5
    Registered User
    Join Date
    04-23-2010
    Location
    DC
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: How to move data to the left most field

    Thank you- are there any pre-made macros to do this as I do not know how to program other than manual macros....

  6. #6
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: How to move data to the left most field

    Did you try my line of code?

+ 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