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?
 
Rgonzo1971Commented:
Sorry for the delay then try
MsgBox Application.Count(Range("C3").CurrentRegion.Columns(3).SpecialCells(xlCellTypeVisible))

Open in new window

0
 
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
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
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
 
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
 
RWayneHAuthor Commented:
Thanks for the help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.