I have a workbook with various worksheets that get saved in different combinations. I have a series of buttons that are clicked to save those different combinations. I need to add a step that prevents the save from happening if certain cells across the worksheets don't match.
Here is one example button:
I need to make sure the following cells match before the save occurs:Private Sub CanineEV_Click() Dim FileName1 As String Path = "L:\lab\reports\results\Pending Review\" FileName1 = Range("T13") ThisWorkbook.Sheets(Array("Canine Wellness", "VitD NEW", "Canine B12")).Select ActiveWorkbook.ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Path & FileName1 & ".pdf", OpenAfterPublish:=False Sheet30.Range("I15:I21").ClearContents Sheet30.Range("T11:V11").ClearContents Sheet30.Range("N29:N29").MergeArea.ClearContents Sheet30.Range("N31:N31").MergeArea.ClearContents Sheet30.Range("M75:M76").ClearContents Sheet39.Range("I19:I22").ClearContents Sheet5.Activate Sheet2.Activate End Sub
Sheet 44 (Canine Wellness) "C3"
Sheet 30 (VitD New) - "D3"
Sheet 39 (Canine B12) "D3"
If they match, save as written above, if not, no save with error message "IDs Don't Match"
Thank you!
Bookmarks