Sub MergePrint()
Dim wsForm As Worksheet, wsData As Worksheet
Dim sRngName As String, r As Long, c As Integer
Set wsForm = Worksheets("Form")
Set wsData = Worksheets("Data")
With wsData.Cells(1, 1).CurrentRegion
For r = 2 To .Rows.Count
If Not wsData.Cells(r, 1).EntireRow.Hidden Then
For c = 1 To .Range("A1").End(xlToRight).Column
sRngName = wsData.Cells(1, c).Value
Range(RangeName(sRngName)).Value = wsData.Cells(r, c)
Next
wsForm.PrintOut
End If
Next
End With
End Sub
|