#2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 111
Default nestint 2 loops

thanks for your help. this doesn't quite give me the results that i'm
looking for because filtering on blank columns doesn't take into account that
some rows are blank in one column but not others. this is a financial
statement that i am working with so you have this kind of format.
Col 1 col 2 col3
Assets
cash 200
receivable 100
total current assets
and so forth. also the macro doesn't loop through each worksheet. the
section of the macro in my question that deletes blank rows i works. and i
know that the part that loops through the workbook works. i just can't seem
to make the two work together

while your macro didn't solve my immediate problem, i have copied it into my
helpful macros book and will find future use for it.

aprilshowers


"Don Guillett" wrote:

For blanks change criteria to
Criteria1:="="

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Don Guillett" wrote in message news:...
try this simple macro to check col A

Sub delete0rows1()
For Each ms In Worksheets

lr = ms.Cells(rows.Count, "a").End(xlUp).Row
With ms.Range("a1:a" & lr)
.AutoFilter Field:=1, Criteria1:="0"
.EntireRow.Delete
.AutoFilter
End With

next ms
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"april" wrote in message
...
i am trying to go through each sheet in a workbook and remove the blank
rows.
i am using this macro

Sub RemoveBlankRows()
Dim mySheet As Worksheet
For Each mySheet In Worksheets
mySheet.Select
Dim FinalRow As Long
Dim RowCounter As Long
Dim ObjVariable As Object
Set ObjVariable = Application.WorksheetFunction
Application.ScreenUpdating = False
FinalRow = ActiveSheet.UsedRange.Rows.Count
For RowCounter = FinalRow To 1 Step -1
If ObjVariable.CountA(Rows(RowCounter)) = 0 Then
Rows(RowCounter).Delete
End If
Next RowCounter
Next my.Sheet
End Sub
--

however, i get the error message "Invalid Next control varialbe
reference".
Any suggestions?

Thanks in advance for your help.
aprilshowers



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default nestint 2 loops


Your sheet loop wont work until you correct the last line
Are you saying you want to delete all rows that have nothing in ANY column?
I would like to see before/after.
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"april" wrote in message
...
thanks for your help. this doesn't quite give me the results that i'm
looking for because filtering on blank columns doesn't take into account
that
some rows are blank in one column but not others. this is a financial
statement that i am working with so you have this kind of format.
Col 1 col 2 col3
Assets
cash 200
receivable 100
total current assets
and so forth. also the macro doesn't loop through each worksheet. the
section of the macro in my question that deletes blank rows i works. and
i
know that the part that loops through the workbook works. i just can't
seem
to make the two work together

while your macro didn't solve my immediate problem, i have copied it into
my
helpful macros book and will find future use for it.

aprilshowers


"Don Guillett" wrote:

For blanks change criteria to
Criteria1:="="

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Don Guillett" wrote in message news:...
try this simple macro to check col A

Sub delete0rows1()
For Each ms In Worksheets

lr = ms.Cells(rows.Count, "a").End(xlUp).Row
With ms.Range("a1:a" & lr)
.AutoFilter Field:=1, Criteria1:="0"
.EntireRow.Delete
.AutoFilter
End With

next ms
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"april" wrote in message
...
i am trying to go through each sheet in a workbook and remove the blank
rows.
i am using this macro

Sub RemoveBlankRows()
Dim mySheet As Worksheet
For Each mySheet In Worksheets
mySheet.Select
Dim FinalRow As Long
Dim RowCounter As Long
Dim ObjVariable As Object
Set ObjVariable = Application.WorksheetFunction
Application.ScreenUpdating = False
FinalRow = ActiveSheet.UsedRange.Rows.Count
For RowCounter = FinalRow To 1 Step -1
If ObjVariable.CountA(Rows(RowCounter)) = 0 Then
Rows(RowCounter).Delete
End If
Next RowCounter
Next my.Sheet
End Sub
--

however, i get the error message "Invalid Next control varialbe
reference".
Any suggestions?

Thanks in advance for your help.
aprilshowers



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 111
Default nestint 2 loops

i looked over my macro and found the error - with a little tinkering, i made
the thing work. yes, i was saying that i wanted to delete all rows that had
nothing in any column.
thanks
--
aprilshowers


"Don Guillett" wrote:


Your sheet loop wont work until you correct the last line
Are you saying you want to delete all rows that have nothing in ANY column?
I would like to see before/after.
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"april" wrote in message
...
thanks for your help. this doesn't quite give me the results that i'm
looking for because filtering on blank columns doesn't take into account
that
some rows are blank in one column but not others. this is a financial
statement that i am working with so you have this kind of format.
Col 1 col 2 col3
Assets
cash 200
receivable 100
total current assets
and so forth. also the macro doesn't loop through each worksheet. the
section of the macro in my question that deletes blank rows i works. and
i
know that the part that loops through the workbook works. i just can't
seem
to make the two work together

while your macro didn't solve my immediate problem, i have copied it into
my
helpful macros book and will find future use for it.

aprilshowers


"Don Guillett" wrote:

For blanks change criteria to
Criteria1:="="

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Don Guillett" wrote in message news:...
try this simple macro to check col A

Sub delete0rows1()
For Each ms In Worksheets

lr = ms.Cells(rows.Count, "a").End(xlUp).Row
With ms.Range("a1:a" & lr)
.AutoFilter Field:=1, Criteria1:="0"
.EntireRow.Delete
.AutoFilter
End With

next ms
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"april" wrote in message
...
i am trying to go through each sheet in a workbook and remove the blank
rows.
i am using this macro

Sub RemoveBlankRows()
Dim mySheet As Worksheet
For Each mySheet In Worksheets
mySheet.Select
Dim FinalRow As Long
Dim RowCounter As Long
Dim ObjVariable As Object
Set ObjVariable = Application.WorksheetFunction
Application.ScreenUpdating = False
FinalRow = ActiveSheet.UsedRange.Rows.Count
For RowCounter = FinalRow To 1 Step -1
If ObjVariable.CountA(Rows(RowCounter)) = 0 Then
Rows(RowCounter).Delete
End If
Next RowCounter
Next my.Sheet
End Sub
--

however, i get the error message "Invalid Next control varialbe
reference".
Any suggestions?

Thanks in advance for your help.
aprilshowers




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
nestint 2 loops april Excel Discussion (Misc queries) 1 August 12th 08 09:22 PM
loops???? harry buggy Excel Worksheet Functions 2 August 14th 07 06:33 PM
Loops SaraJane Excel Discussion (Misc queries) 11 May 26th 07 04:47 AM
Loops [email protected] Excel Discussion (Misc queries) 2 October 14th 06 02:52 PM
Loops... Willabo Excel Discussion (Misc queries) 2 June 14th 06 04:08 PM


All times are GMT +1. The time now is 05:36 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"