Creating Print Macro

G

Guest

I have two linked worksheets where in the first sheet is where I have over
100 employee data stored and in the second sheet, I have a specific template
that contains vlookup formulas that will populate the sheet based on one
input assumption. So if I input Joe Smith in the input cell in Sheet 1,
Sheet 2 will automatically fill in data related to Joe Smith.

Is it possible to create a macro where if there is an "x" next to the
employee data, that sheet 2 will automatically populate, then print employee
1 data, move to next cell marked with "X" and populate and print the next
employee data, and so forth?
 
R

Ron de Bruin

You can loop through the column with the "X" and copy the name to the input cell in Sheet1 and print

Something like this

A column have the names
B column the x

It will copy the value to A1 on sheet1 in this example and then print Sheet2

Sub test()
Dim cell As Range
For Each cell In Sheets("Sheet1").Columns("B").SpecialCells(xlCellTypeConstants)
If LCase(cell.Value) = "x" Then
Sheets("Sheet1").Range("A1").Value = cell.Offset(0, -1).Value
Sheets("Sheet2").PrintOut
End If
Next cell
End Sub
 

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