Get specific column row count within a selected range.

I found the following online and would like to know how to read and edit this.  What each of the 1's are?  I do already understand that the -1 is to not count headers.

MsgBox Cells(1).CurrentRegion.Columns(1).SpecialCells(xlCellTypeVisible).Count - 1

What column of the CurrentRegion.Columns is this?  If I place data in column A it works, but if the data range starts in cell C3, returns zero.

How would I edit this to tell me, what the row count is for a specific columns in a range, no matter where the current selection is?  The first column in the range has x ,  the third column in the range has x.....

This would still be for only visible cells in the preselected range, and not count any blank cells.
RWayneHAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rgonzo1971Commented:
Hi,

 Cells(1)  is A1 if you look for 1st column of  current region adjacent to A1

then try
MsgBox Cells(1).CurrentRegion.Columns(3).SpecialCells(xlCellTypeVisible).Count - 1

Open in new window

REgards
0
RWayneHAuthor Commented:
I am still confused on how to read this.  If Cells(1) is A1?  What if my selected range is C3:F10 and each column has have a different amount of visible cells with values.  How do I start this MsgBox using C3?  and I am still not sure what the (3) is for?

So if I start at C3, how would I tell it to retrieve the number of visibles in column E?
0
Rgonzo1971Commented:
then try
MsgBox Range("C3").CurrentRegion.Columns(1).SpecialCells(xlCellTypeVisible).Count - 1

Open in new window

Columns(1) in this case takes the first column of the current region where c3 is included
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

RWayneHAuthor Commented:
Still not working.  If may range is C3:N9  So the first part is Range("C3").   I get that.  So how do I tell it to count the visibles in column E?  

It would be offset two columns to the right of C3?  When I chg .Columns(1) to .Columns(3) I am getting the same result and it should be different.  I guess I am not getting how to edit which column to count..
0
Rgonzo1971Commented:
then try
Range("C3").CurrentRegion.Columns(3).SpecialCells(xlCellTypeVisible).Count - 1

Open in new window

0
RWayneHAuthor Commented:
Yes I tried this with the (3), and a 2, 4 5,  MsgBox returns the same value no matter what number is in it.  Any ideas?
0
RWayneHAuthor Commented:
All I am doing is highlighting a range starting in C3, and I am looking for a visible count of a column.  Would like to do a count on column E and H.
0
Rgonzo1971Commented:
Could you send a dummy?
0
RWayneHAuthor Commented:
See attached.
SampleA.xlsm
0
Rgonzo1971Commented:
Sorry for the delay then try
MsgBox Application.Count(Range("C3").CurrentRegion.Columns(3).SpecialCells(xlCellTypeVisible))

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RWayneHAuthor Commented:
Thanks for the help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VBA

From novice to tech pro — start learning today.