Thread: Loop?
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Varoujan Varoujan is offline
external usenet poster
 
Posts: 5
Default Loop?

Hi ,

I use excel but I'm new to programming, please excuse me if this is trivial.
I have information on one sheet : let's call it Mainsheet and I want to copy
that info on several other shhets in the following manner.
The information on Main is like a database with the rows being the records.
In the first cell of the row is one " name of the company".
I want to copy the information of that record on a sheet named the same name
as the company name and the info transposed in a column "B". the top record
labels being in column A of the company sheet. (I hope this makes sense).
When I record a macro, everything goes well of course but Ias soon as I try
to make a loop to go through every record, I have errors.
Can someone please give me an idea of how this should be done ?
I already have created the company sheets, so no need to include the
creation of new sheets.

One additional question :
It seems that the "counta" function does not behave the same way when in vba
!
I get an error message whichever way I use it ?

Can I write :
For i= 1 to counta("A2:A50")
.................do this , do that
next i

TIA