Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / August 2007

Tip: Looking for answers? Try searching our database.

Counting number of columns

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gatarossi@ig.com.br - 12 Aug 2007 13:30 GMT
Dear all,

In my VBA code, I need to put a variable... The value of this variable
is the number of columns that there are values. For example:

A     B     C     D     E     F     G    H ...
1      1      1     1     1

In this case the variable must be 5

Other Example

A     B     C     D     E     F     G    H ...
1      1      1     1     1      1     1     1

In this case the variable must be 8

Thanks a lot!

André.
Dave Peterson - 12 Aug 2007 13:46 GMT
If the values are numeric:

Dim myCount as Long
mycount = application.count(worksheets("sheet9999").rows(2))

if the values are alphanumeric, use application.counta()

Remember that all formulas (including formulas that return "") will be counted
in .counta().

> Dear all,
>
[quoted text clipped - 16 lines]
>
> André.

Signature

Dave Peterson

gatarossi@ig.com.br - 12 Aug 2007 14:06 GMT
Dear Dave

Perfect!

Thanks a lot!!!

André.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.