teamramrod737
New Member
- Joined
- Nov 6, 2020
- Messages
- 2
- Office Version
- 2019
- Platform
- Windows
Hello,
I have a workbook that consists of two worksheets (Purchase Orders, COR Back-Up) that I would like to paste the date that the latest page was printed using beforeprint. I was successful in getting it to work for the first worksheet when I was only running it for just one worksheet but because beforeprint is a workbook vba code, I am not sure how to write the code to run depending on the worksheet I am working off of. I will paste the code I am trying to use below but it keeps giving me errors.
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet = "Purchase Orders" Then
Sheets("Purchase Orders").Range("B39") = Now()
Else
If ActiveSheet = "COR Back-up" Then
Sheets("COR Back-up").Range("D17") = Now()
End If
End If
End Sub
Sorry if this in buried in an old post but I couldnt find anything that was an exact match to my problem. Thanks in advance.
I have a workbook that consists of two worksheets (Purchase Orders, COR Back-Up) that I would like to paste the date that the latest page was printed using beforeprint. I was successful in getting it to work for the first worksheet when I was only running it for just one worksheet but because beforeprint is a workbook vba code, I am not sure how to write the code to run depending on the worksheet I am working off of. I will paste the code I am trying to use below but it keeps giving me errors.
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet = "Purchase Orders" Then
Sheets("Purchase Orders").Range("B39") = Now()
Else
If ActiveSheet = "COR Back-up" Then
Sheets("COR Back-up").Range("D17") = Now()
End If
End If
End Sub
Sorry if this in buried in an old post but I couldnt find anything that was an exact match to my problem. Thanks in advance.