I have a workbook of ten sheets. In sheet 1, I want to list out sheet names (sheets 3 thru 10), column heading values in the sheet (columns 8 and beyond only) and for that column the number of cells that have data in it.
My code works for two of these three requirements. On my sheet 1 (named: SheetName Columns) I get the Sheet Names in column A and Column Heading in column B, however not having any luck getting that sheet/columns number of data rows.
On my sheet 1, column A gets duplicated per number of columns after column 7 on that sheet and that is fine.
Sub ListColumnHeadings()
Dim cNbrs As Long, i As Integer, tr As Long, tc As Long, wst As Worksheet
Dim charList(300, 300) As String
Dim ws As Worksheet, OutputRow As Long
Dim myRange As Range
Dim NumRows As Integer
Dim colNbr As Range
Set shSkip1 = ThisWorkbook.Sheets("SheetName Record Cnt")
Set shList = ThisWorkbook.Sheets("SheetName Columns")
OutputRow = 1
On Error Resume Next
For Each ws In Worksheets
  If ws.Name <> shList.Name And ws.Name <> shSkip1.Name Then
    cNbrs = ws.Range("A1").CurrentRegion.Columns.Count
    For i = 8 To cNbrs
      shList.Cells(OutputRow, "A").Value = ws.Name
      shList.Cells(OutputRow, "B").Value = ws.Cells(1, i)
      Set myRange = ws.Columns(i).Select
      NumRows = ws.Application.WorksheetFunction.CountA(myRange)
      If NumRows > 0 Then
        shList.Cells(OutputRow, "C").Value = NumRows
      End If
      OutputRow = OutputRow + 1
    Next i
  End If
Next ws
End Sub
 
     
     
    