Results 1 to 8 of 8

Thread: Help with Blank columns

  1. #1
    Acolyte happy_smiler1's Avatar
    Join Date
    Aug 2012
    Posts
    67
    Articles
    0
    Excel Version
    office 365

    Help with Blank columns



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hi All,

    Does anyone know any type of vba to be able to look down columns and find all the blanks and delete them as some for some reason the excel formulas I have in place doesnt pick up the data I need unless I delete the blank columns.

    I have attached a dummy data spreadsheet if anyone could help?

    TIA
    Attached Files Attached Files

  2. #2
    Conjurer alansidman's Avatar
    Join Date
    Oct 2018
    Location
    Steamboat Springs
    Posts
    204
    Articles
    0
    Excel Version
    2019
    Code:
    Option Explicit
    
    
    Sub DelBlnk()
        Dim i As Long, lr As Long
        lr = Range("B" & Rows.Count).End(xlUp).Row
        For i = lr To 3 Step -1
            If Range("C" & i) = "" Then
                Range("C" & i).EntireRow.Delete
            End If
        Next i
    End Sub

  3. #3
    Acolyte happy_smiler1's Avatar
    Join Date
    Aug 2012
    Posts
    67
    Articles
    0
    Excel Version
    office 365
    If im reading that code correctly, its saying if it finds a blank cell then its going to delete the row? what happens if if there is blank cell in column B5 but no data in column C5, i dont want to delete the row, just to delete the blank cells. Not sure if this is even possible.

  4. #4
    Conjurer alansidman's Avatar
    Join Date
    Oct 2018
    Location
    Steamboat Springs
    Posts
    204
    Articles
    0
    Excel Version
    2019
    When you say you want to delete the cell, please explain. Do you want the cell below to replace it? I don't know what you mean. If its blank, then there is nothing there. Please show an example in your file of what your file should look like if the cell is "deleted."

  5. #5
    Super Moderator p45cal's Avatar
    Join Date
    Dec 2012
    Posts
    1,675
    Articles
    0
    Excel Version
    365
    Quote Originally Posted by happy_smiler1 View Post
    the excel formulas I have in place doesnt pick up the data I need unless
    such as?

  6. #6
    Acolyte happy_smiler1's Avatar
    Join Date
    Aug 2012
    Posts
    67
    Articles
    0
    Excel Version
    office 365
    No worries, I have managed to do it a different way without any vba.

    Thanks

  7. #7
    Conjurer alansidman's Avatar
    Join Date
    Oct 2018
    Location
    Steamboat Springs
    Posts
    204
    Articles
    0
    Excel Version
    2019
    For the benefit of all who look at this site, please share your solution.

  8. #8
    Acolyte happy_smiler1's Avatar
    Join Date
    Aug 2012
    Posts
    67
    Articles
    0
    Excel Version
    office 365
    I ended up just doing a macro and re-arranging my data as using the vba code deleted the entire row which isnt what I needed.

    Much appreciated for the effort and response.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •