Sub CountDataInColumns()
Dim ws1 As Worksheet, ws2 As Worksheet
Dim lc As Long, c As Long, r As Long
Set ws1 = Sheets("Sheet1")
On Error Resume Next
Set ws2 = Sheets("ValueCount")
ws2.Cells.Clear
On Error GoTo 0
If ws2 Is Nothing Then
Set ws2 = Sheets.Add(after:=ws1)
ws2.Name = "ValueCount"
End If
lc = ws1.Cells(1, Columns.Count).End(xlToLeft).Column
r = 2
For c = 1 To lc
ws2.Cells(r, 1) = ws1.Cells(1, c)
ws2.Cells(r, 2) = Application.CountA(ws1.Columns(c))
r = r + 1
Next c
End Sub
pls try
Open in new window
Regards