+ Reply to Thread
Results 1 to 4 of 4

Combining data leaving out blanks

Hybrid View

Tino XXL Combining data leaving out... 12-02-2010, 11:15 AM
stnkynts Re: Combining data leaving... 12-02-2010, 11:59 AM
watersev Re: Combining data leaving... 12-02-2010, 12:10 PM
snb Re: Combining data leaving... 12-02-2010, 12:18 PM
  1. #1
    Registered User
    Join Date
    11-29-2010
    Location
    Belgium
    MS-Off Ver
    2010
    Posts
    87

    Exclamation Combining data leaving out blanks

    Hi

    Can you pls help me out with the following issue. You'll find a file in attachment.
    The red field shows you the data I have. The green field shows you what I should get too.

    I'm really stuck on this one and my boss expects a solution asap.

    Kind regards
    Tino XXL
    Attached Files Attached Files
    Last edited by Tino XXL; 12-07-2010 at 11:59 AM.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: Combining data leaving out blanks

    Hello friend,

    I started working out an answer for you but encountered a problem myself. Here is two different macros that should do around the same thing and should work. Only problem is that when i run it on your workbook it will not delete and shift up all the rows, just some of them. Maybe someone else here can weigh in.

    Option Explicit
    
    Sub masroiu()
    Dim iCell As Range
    
    For Each iCell In Range("A1:B46")
        If IsEmpty(iCell) = True Then
            iCell.Delete Shift:=xlUp
        End If
    Next iCell
    
    End Sub
    Option Explicit
    
    Sub Deleteblanks()
    Dim alastrow As Long
    Dim blastrow As Long
    Dim iCell As Long
    
    alastrow = Range("A" & Rows.Count).End(xlUp).Row
    blastrow = Range("B" & Rows.Count).End(xlUp).Row
    
    For iCell = 1 To alastrow
        If IsEmpty(Range("A" & iCell)) = True Then
            Range("A" & iCell).Delete Shift:=xlUp
        End If
    Next iCell
    
    For iCell = 1 To blastrow
        If IsEmpty(Range("B" & iCell)) = True Then
            Range("B" & iCell).Delete Shift:=xlUp
        End If
    Next iCell
    
    End Sub

  3. #3
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Combining data leaving out blanks

    one of the options to make it

    Press Start
    Attached Files Attached Files

  4. #4
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Combining data leaving out blanks

    1. empty all 'empty looking' cells in column B
    2. Use

    Sub tst()
      For Each ar In ThisWorkbook.Sheets(1).Columns(2).SpecialCells(4).Areas
        ar.Value = ar.Offset(1).Cells(ar.Cells.Count).Value
      Next
      ThisWorkbook.Sheets(1).Columns(1).SpecialCells(4).EntireRow.Delete
    End Sub
    PS. Trek je niet teveel van die bazen aan....



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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