"for ... to ..." with input from list

C

claudio

I have a list of 30 names. A macro should input the first name into cell A1,
print the spreadsheet, input the second name into A1, print etc.

The list can be either in a spreadsheet or in the VBA code.

I used to copy-paste the following code 30 times and had to replace {name}
each time. What is the more effective way? Thanx in advance!

Range("A1").Select
ActiveCell.FormulaR1C1 = {name}
Range("A2").Select 'to calculate cells again
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
 
B

Bob Phillips

Something like

For i = 1 To 30
Range("A1").Value = Worksheets("Sheet2").Cells(i,"M"(.Value
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Next i

where M1:M30 on sheet2 holds the list of names


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top