■ Excel/ㅡExcel VBA Code

엑셀 VBA 특정 셀 내용이 바뀌면 출력 미리 보기 실행

with seok 2020. 4. 1. 06:49

 

 

 

미리 보기 화면 실행
Private Sub Worksheet_Change(ByVal Target As Range)

    If Target.Address = "A1" Then
        ActiveWindow.SelectedSheets.PrintOut preview:=True
    End If

End Sub
미리 보기 없이 바로 출력
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim KeyCells As Range

    ' The variable KeyCells contains the cells that will
    ' cause an alert when they are changed.
Set KeyCells = Range("A1")

If Not Application.Intersect(KeyCells, Range(Target.Address)) _
           Is Nothing Then

    ' Display a message when one of the designated cells has been
    ' changed.
    ' Place your code here.
        Range("C1").CurrentRegion.Select
        Selection.PrintOut From:=1, To:=1, Preview:=False

End If
End Sub

728x90