+ Reply to Thread
Results 1 to 8 of 8

Move data row by row to left hand side of an array across blank cells

  1. #1
    Registered User
    Join Date
    09-06-2012
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Question Move data row by row to left hand side of an array across blank cells

    I have an array into which I paste values (golf handicaps) from another part of the sheet. The columns respresent the competition and each row a member of the group. As everyone in our group does not play each competition, there are blank cells. I want copy the array to another table and go through the membership,the array, row by row and move the handicap values to the left of the array so there are no blank cells in each row. Any suggestions would be appreciated. Thank you. Although I am eighty two years old, I have been given the task of writing a program and I have EXCEL to do it. My previous programming was done using fortran and VBA is somewhat foreign to me.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Move data row by row to left hand side of an array across blank cells

    attach please a sample with current and desired table
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    09-06-2012
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Move data row by row to left hand side of an array across blank cells

    The data I have could be in the follwoing format


    26 15 29
    31 24 22

    I want to move the values to the left for each row

    26 15 29
    31 24 22

    Thank you
    Fred99

  4. #4
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Move data row by row to left hand side of an array across blank cells

    attach please a sample FILE with current and desired table

  5. #5
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Move data row by row to left hand side of an array across blank cells

    Hi, Fred99,

    and what about the data which already has been inserted into the survey?

    Please try the code on a copy of your workbook.

    The following macro has to be executed on the survey sheet (it will always run on the sheet which is active in the Excel application). Press ALT+F11 to enter the VBE, search for the workbook name in the project explorer, expand the project if only a + is shown, insert a standard module via menu, insert the following code there, press F5 to run the macro:

    Please Login or Register  to view this content.
    If you have any questions regarding the code or problems with the deletion of cells (unwanted results) please come back and tell us about these. This might be the start of one way to solve the problem.

    If you cannot run macro actions in your workbook go to the symbol in the upper left, choose Excel-Options, Safety, check the button for macro security.

    Ciao,
    Holger

  6. #6
    Registered User
    Join Date
    09-06-2012
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Move data row by row to left hand side of an array across blank cells

    Thank you Holger. I will try it tomorrow as its late now, just gone midnight.
    Will let you know if I have any problems.
    Thanks agaqin
    Fred99

  7. #7
    Registered User
    Join Date
    09-06-2012
    Location
    Melbourne, Australia
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Move data row by row to left hand side of an array across blank cells

    I have tried the code you forwarded to me. It works like a charm. It is so easy if you learn the code.
    Thank you again for your trouble

  8. #8
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Move data row by row to left hand side of an array across blank cells

    @ Fred99

    Welcome to the forum.

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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