Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to read columns in excel & set # of columns as a count. 1

Status
Not open for further replies.
Feb 28, 2002
26
US
I need to read across columns to determine the number columns. I need to use this number in macros I need to write.

Regards.
 
A range has a collection of columns so you should be able to use :

Range("Range").Columns.Count

To get the total columns in use in the active sheet use :

ActiveSheet.UsedRange.Columns.Count

Hope this assists

A.C.
 
A.C.

Thanks for the help on this. I used your example among a couple others I found in the manuals.

Thanks again,

G
 
Guy,

Pssssssssssst... you "forgot to issue a STAR".

Actually I see from your profile that you're relatively new to Tek-Tips and therefore not yet aware of this "accepted practice" of showing "proper" recognition and thanks for the contributor having taken time out of their busy schedule to develop a solution for you.

Issuing a STAR is simply a matter of clicking on the "Click here to mark this post as a helpful or expert post!" - located in the lower-left-corner of the contributor's posting.

I'm told these STARS also serve as "beacons" for other Tek-Tips "browsers" who are "on the lookout" for solutions to similar problems, or just want to build up a "library" of useful solutions.

PLEASE do NOT issue a star for this "reminder". I want to earn stars in the normal way. Thanks.

Regards, ...Dale Watson dwatson@bsi.gov.mb.ca
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top