ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Creating Print Macro (https://www.excelbanter.com/excel-discussion-misc-queries/140909-creating-print-macro.html)

confused

Creating Print Macro
 
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?

Ron de Bruin

Creating Print Macro
 
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(xlCellT ypeConstants)
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




--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


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



All times are GMT +1. The time now is 03:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com