Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default "for ... to ..." with input from list

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default "for ... to ..." with input from list

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)

"claudio" wrote in message
...
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
When I input "25:03" as a time, it reads "1:03" Darryl_Neeley Excel Discussion (Misc queries) 9 September 26th 07 09:20 PM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
cannot use "Create List" and "Share Workbook" same time Devendra Excel Discussion (Misc queries) 0 October 26th 06 06:05 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM


All times are GMT +1. The time now is 10:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"