Private Sub Workbook_Open()
B = Split(Names("確認欄").Value, "!") '取得"確認欄"名稱的地址
Range(B(1)).ClearContents '清空確認欄內的值
End Sub
Private Sub CommandButton1_Click()
Dim r&
With Sheets([H1].Value) '取得[H1]儲存格的值,並找到此名稱的工作表
For r = 2 To Cells(Rows.Count, 2).End(xlUp).Row '資料範圍
If Cells(r, 1) = "**" Then Exit Sub '離開程序,停止列印
If Cells(r, 1) = "V" Then '有"V"才列印
.[H2] = Cells(r, 2)
.[F6] = Cells(r, 3)
.[E11] = Cells(r, 4)
.[H3] = Cells(r, 5)
.[B4] = Cells(r, 6)
.[B6] = Cells(r, 7)
'.PrintPreview '預覽
.PrintOut '列印
End If
Next r
End With
End Sub