|
こんにちは
これで如何でしょうか?
Sub Test_1()
Dim Sh As Worksheet, i As Long, Co As Long
Set Sh = Worksheets("はがき縦")
With Worksheets("名簿")
For i = 2 To .Range("A65536").End(xlUp).Row
If .Cells(i, 1).Value = "レ" Then
Sh.Range("E9,H9,E4,F5,G6,E1:J1").ClearContents
Sh.Range("E9").Value = .Cells(i, 1).Value
Sh.Range("H9").Value = .Cells(i, 2).Value
Sh.Range("E4").Value = .Cells(i, 5).Value
Sh.Range("F5").Value = .Cells(i, 6).Value
Sh.Range("G6").Value = .Cells(i, 7).Value
For Co = 1 To Len(.Cells(i, 4).Value)
Sh.Range("E1").Offset(, Co - 1).Value = Mid(.Cells(i, 4).Value, Co, 1)
Next Co
Sh.PrintOut Preview:=True
End If
Next i
End With
Set Sh = Nothing
End Sub
|
|