View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Different Values & Printing.

Hi Emma

This will change the value of A6 so all cells will be updated with the values .
Print the Sheets("form") and change the value(a6) to the next value......

For Each cell In Sheets("data").Columns("A").SpecialCells(xlCellTyp eConstants)

It will use all cells with a value in the A column on Sheets("data").

Sub test()
Dim cell As Range
For Each cell In Sheets("data").Columns("A").SpecialCells(xlCellTyp eConstants)
Sheets("form").Range("A6").Value = cell.Value
Sheets("form").PrintOut
Next
End Sub


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Emma Hope" wrote in message ...
I have two Excel sheets, the first is a data page, the
second is a form.

The form picks up data from Sheet1 using vlookups based on
a value that is typed in cell A6, the form is then printed.

I would like to create a macro that will cycle through the
list of values on the data sheet (the number of lines
could vary) and then print each sheet before moving to the
next value and printing.

For example:
Data sheet
Name Age Gender
Fred 20 M
Tom 45 M
Sally 31 F

the form then reads the first cell Fred and puts it in
cell A6 (the vlookups pick up the rest of the data), the
form then prints. Then it picks up the second value Tom,
puts it in A6 (again vlookups) and prints and so on until
it gets to the end of the list which could be a blank cell
or a particular word like "Total", i don't mind what this
is, what ever is easiest for the macro.

I really need some help, i'm stuck.
Thanks
Emma