View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Les Les is offline
external usenet poster
 
Posts: 240
Default Loop through sheets and get number of records per sheet

A Gentelman and a life saver....

Thanks so much Sam, much appreciated.
--
Les


"Sam Wilson" wrote:

Sub test()

Dim summ As Worksheet
Dim ws As Worksheet

Set summ = Worksheets.Add
summ.Name = "Summary"
Dim x As Integer

For Each ws In Worksheets
If ws.Name < "Summary" Then
summ.Range("a1").Offset(x, 1).Value =
ws.Cells.SpecialCells(xlCellTypeLastCell).Row
summ.Range("a1").Offset(x, 0).Value = ws.Name
x = x + 1
End If

Next ws

End Sub


"Les" wrote:

Hi all, i have a variable number of sheets in a workbook, with variable rows
of data in each sheet. Each sheet has a specific name. I need to loop through
all sheets and get the number of rows per sheet and store the number of rows
per sheet/name on a summary sheet.
e.g.

George 20
Les 150
Johan 60


Any help is as per normal much appreciated

--
Les