Hi.
I am trying to take the name of an employee from column A on sheet named "DATA" and place it in B8 on sheet called "TIME_SHEET"
Then
I am trying to take the pay band of the employee from column B on sheet named "DATA" and place it in B10 on sheet called "TIME_SHEET"
I have a lot of employeesand there data is set out on the sheet "DATA"
Row 1 Cell A Employee name Row 1 Cell B Employee Pay Band.
Below is my code (at which I am not to good at)
I am unable to get it to loop to allow me to print off each members pay sheet with the fields filled out.
Option Explicit
Sub PRINT_TIME_SHEET()
Dim myCell As Range
Dim myCell2 As Range
Dim myNamesRng As Range
Dim myNamesRng2 As Range
Dim myHeaderCell As Range
Dim myHeaderCell2 As Range
With Worksheets("DATA")
Set myNamesRng = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp))
Set myNamesRng2 = .Range("b1", .Cells(.Rows.Count, "B").End(xlUp))
End With
With Worksheets("TIME_SHEET")
Set myHeaderCell = .Range("b8")
Set myHeaderCell2 = .Range("b10")
For Each myCell In myNamesRng.Cells
myHeaderCell.Value = myCell.Value
For Each myCell2 In myNamesRng2.Cells
myHeaderCell2.Value = myCell2.Value
.PrintOut preview:=True
Next myCell
myHeaderCell2.ClearContents
myHeaderCell.ClearContents
End With
End Sub
Bookmarks