+ Reply to Thread
Results 1 to 8 of 8

VBA to remove blak cells in a row and output values in consecutive cells

  1. #1
    Registered User
    Join Date
    11-05-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    13

    VBA to remove blak cells in a row and output values in consecutive cells

    Hi,

    I need a VBA code to remove blank cells within a row in another worksheet. Lets call the work sheets with the blank cells "WorkSheet1" I used IF statements to output a value or a "" but it starts on I10:I1000 and in some rows i only have 1 cell that has value. I want to use VBA on another work sheet to consolidate the non blank cells by outputting them consecutively in one row with no blanks from one value to the next.

    Any help is greatly appreciated.

  2. #2
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: VBA to remove blak cells in a row and output values in consecutive cells

    find attached !

    Hope this helps !


    Click"*" add rep icon in the bottom left corner of my post if this helps
    Attached Files Attached Files
    -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    WANT TO SAY THANKS, HIT ADD REPUTATION (*) AT THE BOTTOM LEFT CORNER OF THE POST

    More we learn about excel, more it shows us, how less we know about it.

    for chemistry
    https://www.youtube.com/c/chemistrybyshivaansh

  3. #3
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: VBA to remove blak cells in a row and output values in consecutive cells

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    11-05-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: VBA to remove blak cells in a row and output values in consecutive cells

    hey Hemesh,

    Thanks for you quick response. the code works nicely but my data is laid out horizontally (in a row). Also, is there anyway not to use a toggle button? and have it rerun every time when the file is opened?

  5. #5
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: VBA to remove blak cells in a row and output values in consecutive cells

    can you please upload a sample book

    to attach go to advance option select paper clip icon or select advance option

  6. #6
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: VBA to remove blak cells in a row and output values in consecutive cells

    Please Login or Register  to view this content.

  7. #7
    Forum Expert
    Join Date
    02-19-2013
    Location
    India
    MS-Off Ver
    07/16
    Posts
    2,386

    Re: VBA to remove blak cells in a row and output values in consecutive cells

    FIND ATTCHED !


    1.Open the book where you want to run this macro AUtomatically
    2.Open VBA window in left hand side select thisworkbook under your file name
    3.Type
    Private Sub Workbook_Open()
    call copynonblankcells
    End Sub
    4.keep your original macro in the module

    see attached file for further reference
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    11-05-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: VBA to remove blak cells in a row and output values in consecutive cells

    Sure thing. The data sheet has the raw data and the summary is where i want to organize and remove the blanks. The purpose is i have assemblies (cells in red) that is shared in both spread sheets; in the data sheet i have assemblies in the first column and parts 1-1000 in a row, as i am create each assembly i check what parts i need and the same assembly name is pulled to the summary sheet but in the summary sheet i only want to show the parts that is needed per assembly.
    Attached Files Attached Files

+ 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. Average Ignoring Zero Values - Non-consecutive cells
    By a7mad3wies in forum Excel General
    Replies: 2
    Last Post: 12-05-2013, 02:13 AM
  2. Highlighting consecutive cells based on values
    By thelegazy in forum Excel General
    Replies: 2
    Last Post: 07-22-2013, 05:24 PM
  3. Replies: 1
    Last Post: 05-29-2013, 10:35 AM
  4. [SOLVED] Average for non-consecutive cells, excluding zero values.
    By musik7 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-29-2013, 06:11 PM
  5. [SOLVED] find the max values for cells in consecutive groups of 600
    By john in forum Excel General
    Replies: 2
    Last Post: 10-04-2005, 06:05 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