Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
How do you check to see if a row has nothing in any of the cells in VBA?
I need to delete the row if there is nothing in it, and shift the rest of the data up. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Sub gsnu()
Dim j As Long Dim i As Long Dim r As Range Dim r2 As Range Set r2 = ActiveSheet.UsedRange j = r2.Rows.Count + r2.Row - 1 For i = 1 To j If Application.CountA(Rows(i)) = 0 Then If r Is Nothing Then Set r = Rows(i) Else Set r = Union(r, Rows(i)) End If End If Next i If Not r Is Nothing Then r.EntireRow.Delete End If End Sub -- Gary''s Student - gsnu200736 "pokdbz" wrote: How do you check to see if a row has nothing in any of the cells in VBA? I need to delete the row if there is nothing in it, and shift the rest of the data up. |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
You could also do this with a formula, counting the blanks. =SUM(--
(ISBLANK(A1:Z1)) entered as an array formula sums all instances of blank cells; if the sum equals 26 then you know the row is blank, etc. This obviously is less automated than the VBA solution. Dave On Aug 7, 9:08 am, pokdbz wrote: How do you check to see if a row has nothing in any of the cells in VBA? I need to delete the row if there is nothing in it, and shift the rest of the data up. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Check if Conditional Format is True or False / Check cell Color | Excel Worksheet Functions | |||
How do I increase the size of check in check boxes | Excel Discussion (Misc queries) | |||
Enable check box in protected sheet + group check boxes | Excel Discussion (Misc queries) | |||
... Can I set Spell Check to automatically check my spelling ... | Setting up and Configuration of Excel | |||
check box, so when you click on it it inserts a check mark into t. | Excel Discussion (Misc queries) |