![]() |
Loop through worksheets
I have the following code which acts on one sheet. How could I get it to
loop through all sheets. Sub sumrows() Dim LastRow As Long With Sheets("Jan 2009") .Range("b:b").AdvancedFilter _ Action:=xlFilterCopy, CopyToRange:=.Range("X1"), _ CriteriaRange:="", Unique:=True LastRow = .Cells(.Rows.Count, "X").End(xlUp).Row For Each cell In .Range("X2:X" & LastRow) If cell.Value = "" Then Exit Sub cell.Offset(0, 1) = _ Application.WorksheetFunction.SumIf( _ .Range("b:b"), "=" & cell.Value, .Range("D:D")) Next End With End Sub |
All times are GMT +1. The time now is 03:41 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com