Hi Guys,
Im trying to make sort of a Summary of a file pop-up displaying the counts of certain Columns, instead of manually counting the rows count and checking if they tally I'd like to make a macro that just throws a pop-up with the following output:
Summary:
SKUS: 12
Desc: 12
etc
where SKUS, Desc are certain column headers and are not the same in every sheet. So basically it should look for the column with those headers and count number of rows with data. I've attached a sample file.
I've got a way to count the cells atm but I dont know how to make it look for a column name and count
Thanks guys,Sub Summarize() Dim n As Integer n = Worksheets("Sheet1").Range("A:A").Cells.SpecialCells(xlCellTypeConstants).Count MsgBox (n - 1) End Sub
hi
there is something wrong with your example? SKUS should br 8 or I am wrong?
try to use something like this
you can modify thisSub aa() Dim a As Long a = Application.WorksheetFunction.CountA(Cells(2, 1).Resize(9, 1)) MsgBox Cells(1, 1) & Chr(10) & a End Sub
Last edited by tom1977; 01-16-2012 at 05:01 PM.
Regards
tom1977
If You are satisfied with my solution click the small star icon on the left to say thanks.
Hi Tom,
How can I get this to work based on the column headers??
Because they wont always be in the same order and same range.
something like .
Look for column with header SKU & then count rows, instead of giving the range?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks