Results 1 to 5 of 5

Thread: Delete all Even cells in Excel

  1. #1
    Join Date
    May 2009
    Posts
    735

    Delete all Even cells in Excel

    Hello , i want to delete even cell in excel but cannot do it , I have a little trouble with some VBA code. can I delete all the empty cells in Excel to the top so that all non-empty cells are found next to each other.

  2. #2
    Join Date
    Sep 2005
    Posts
    1,306

    Re: Delete all Even cells in Excel

    Hello , try this Code

    last_cell = ActiveCell.SpecialCells (xlLastCell)
    For i = last_cell To 1 Step -1
    If Application.WorksheetFunction.CountA (Cells (i, i)) = 0 Then
    Cells (i, i). Delete Shift: = xlUp
    End If
    Next i

  3. #3
    Join Date
    Apr 2008
    Posts
    2,139

    Re: Delete all Even cells in Excel

    If you are using VBA, then the simple macro will allow to delete all even numbered cell from cell 1 through 28. To get odd numbers, simplly change the second line to For i = 27 to 1 Step -1. To expand the rand, change the 2 number to the desired target.
    Sub row()
    For i = 28 To 2 Step -2
    Rows(i).Delete
    Next i
    End Sub

  4. #4
    Join Date
    May 2008
    Posts
    4,831

    Re: Delete all Even cells in Excel

    hello,

    Hope i can help you, I had the same problem and I tried this code:

    Range ( "A1"). Select
    Do While ActiveCell.Value = ""
    Selection.Delete Shift: = xlUp
    Loop

    But I just found the solution by myself for your code, it is a lot easier:
    try this

    Selection.SpecialCells (xlCellTypeBlanks). Select
    Selection.Delete Shift: = xlUp

  5. #5
    savil76 Guest

    Re: Delete all Even cells in Excel

    too diffcult for me..

Similar Threads

  1. Format cells in Excel 2010
    By Morag T in forum MS Office Support
    Replies: 2
    Last Post: 17-03-2012, 11:17 AM
  2. How to add similar characters in Excel Cells
    By $horizon$ in forum MS Office Support
    Replies: 4
    Last Post: 08-02-2012, 04:10 PM
  3. How to renumber cells in Microsoft Excel
    By Weslee in forum MS Office Support
    Replies: 2
    Last Post: 24-01-2012, 05:25 PM
  4. Can't insert cells in Excel
    By Xavier1234 in forum Windows Software
    Replies: 3
    Last Post: 06-06-2009, 07:46 PM
  5. Excel Numbering of identical cells
    By Bullnettles in forum Windows Software
    Replies: 6
    Last Post: 07-04-2009, 10:51 AM

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
  •  
Page generated in 1,713,493,124.57746 seconds with 17 queries