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.
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.
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
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
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
too diffcult for me..
Bookmarks