Darren Bartrup
Well-known Member
- Joined
- Mar 13, 2006
- Messages
- 1,297
- Office Version
- 365
- Platform
- Windows
It's been a while since I've visited MrExcel, but I've been busy learning C# & ASP.Net & Visual Studio & SQL Server - work doesn't want too much from me 
Anyway, I'm writing a procedure that plays around with lists in Excel (i.e. the type of list that would show up in CurrentRegion.
They're not connected to any outside data source, or as a pivot table - just columns of data that will have a header row in a different format than the data body.
Is there any way of cycling through each sheet in the workbook and identifying each occurrence of a list?
I've been playing with the code at the bottom of the post, and it finds the boundaries of each list providing (at the moment) that each list starts on row 1. There are other problems with it however.
Basically, is there an easier way to go about this? And to identify the values in the header row?
Many thanks in advance for any help.
Darren.

Anyway, I'm writing a procedure that plays around with lists in Excel (i.e. the type of list that would show up in CurrentRegion.
They're not connected to any outside data source, or as a pivot table - just columns of data that will have a header row in a different format than the data body.
Is there any way of cycling through each sheet in the workbook and identifying each occurrence of a list?
I've been playing with the code at the bottom of the post, and it finds the boundaries of each list providing (at the moment) that each list starts on row 1. There are other problems with it however.
Basically, is there an easier way to go about this? And to identify the values in the header row?
Many thanks in advance for any help.
Darren.
Code:
For Each wrkSht In ThisWorkbook.Worksheets
Set srchCell = wrkSht.Cells(1, 1)
Debug.Print "Worksheet: " & wrkSht.Name
Do Until srchCell.Column > 255
rTble = srchCell.CurrentRegion
If Not IsEmpty(rTble) Then
Debug.Print "Start Row: " & srchCell.Row & " ~ End Row: " & UBound(rTble)
Debug.Print "Start Col: " & srchCell.Column & " ~ End Col: " & srchCell.Column + UBound(rTble, 2)
Debug.Print
End If
Set srchCell = srchCell.End(xlToRight)
If IsEmpty(srchCell) Then
Set srchCell = srchCell.End(xlToRight)
End If
Loop
Next wrkSht