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 / June 2005

Tip: Looking for answers? Try searching our database.

VBA, repeat command

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
p.strijbosch@chello.nl - 29 Jun 2005 13:56 GMT
Hello!

Can some one tell me how to repeat a specific command within a Macro?
My case:
In tab 1 I copy in columns of raw unsorted data
In tab 2 the raw data from tab 1 needs to be grouped and sorted
according to a custom format.

I already defined a macro that copies the raw data and puts it into the
custom format, but as the number of columns differs I was wondering if
there is a statement in VBA that repeats a command depending on the
amount of columns (ranges) that are provided.

Thanx in advance!

Regards,
Robert
Bob Phillips - 29 Jun 2005 14:21 GMT
   For i = 1 to Cells(1,Columns.Count).End(xlToLeft).Column
       do your stuff on Columns(i)
   Next i

which will identify all the columns and loop through them one at a time.

Does this help?

Signature

HTH

Bob Phillips

> Hello!
>
[quoted text clipped - 13 lines]
> Regards,
> Robert
 
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.