Results 1 to 20 of 26

Thread: Solved: Delete Empty cells with condition

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Solved: Delete Empty cells with condition

    Hello,

    OK I want to delete cells in a spreadsheet based on the contents of Column B

    I am gonna word it out so you can understand:

    I want to delete all rows in a spreadsheet that contain no data in column B, as long as the data in column A is not "Cookies", or "Salt". The range of cells I want to delete spams from "A7:G7". when deleting this I want to shift the cells up because there is data beyond column "G" that I want to maintain.

    After the cells are deleted I will have to restore my formula(s) down until "B200:G200"

    Also there is a conditional formatting rule to shade every other row that always gets messed up, I would like it restored to cover the Range "A7:G200" The formula I am using is " =MOD(ROW(),2)=1"

    Then I will reset the print area, for that I made this code (not too much to brag about):

    [VBA]Sub SetPrintArea()

    If Not Sheets("Sheet1").Range("A34").Value = "" Then
    ActiveSheet.PageSetup.PrintArea = Range("A1:N1", Range("A" & Rows.Count).End(xlUp)).Address
    Else
    ActiveSheet.PageSetup.PrintArea = Range("A1:N34").Address
    End If

    End Sub
    [/VBA]

    I made a small sample of my document. Not all the columns were included. Delete Empty rows.xls

    Thanks any help will be more than welcome

    BTW this is an updated version of my original post http://www.vbaexpress.com/forum/showthread.php?t=42305 I desided to remove the table and use normal ranges because I was having problems with my other copy paste macros. Any ways what I was looking for was the alternating row shading and i got that with my formula.
    Last edited by fredlo2010; 05-28-2012 at 05:42 PM.
    Feedback is the best way for me to learn


    Follow the Armies

Posting Permissions

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