View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
pancho[_6_] pancho[_6_] is offline
external usenet poster
 
Posts: 3
Default looping to create multiple files

You save time if you ask completely for the first time,

you can use something like:
Dim list As Variant, i
list = ActiveSheet.Range(Range("A1"), _
Range("A1").End(xlDown)).Value
For i = 1 To UBound(list)
MsgBox list(i, 1)
Next i



Francisco Mariscal
fcomariscal at hotmail dot com



-----Original Message-----
I got this to work but then in order to change the list

of
rep names, the person would have to go into the code.

How
can I set the array to be cells on a particular
spreadsheet?

Thank you.
-----Original Message-----
try something like this:
Dim repNames as variant, i as integer
repNames=Array("Rep numb1", "rep2", "rep3")
' the array must contain the reps names you use
' on your code actually
for i=0 to ubound(repNames)
' this is your loop you are looking for
' you can use your code for one rep
' and the name of the sales rep is contained
' in repnames(i) like this
msgbox repNames(i)
' so you need to detect which instructions are
' for exactly one rep sales and put that code here
next i


-----Original Message-----
I wrote code that takes a template, populates it with a
Sales Rep's personal data, remove sales that aren't

theirs
and then saves the file as their file with a user
specified as of date. I then have code for each sales

rep
repeating the above.

Instead, can I write the code only once and then use a
loop to cycle through a list of all the reps maintained

on
a separate spreadsheet? This way, the code can be only
one person long and it will be easier to add things to

the
macro and revise the macro.

I do not know how to write a loop.
Thank you
.

.

.