+ Reply to Thread
Results 1 to 5 of 5

Active sheet do not print if cell n8 to n15 are blank

  1. #1
    Forum Contributor
    Join Date
    05-01-2013
    Location
    Canada
    MS-Off Ver
    Office 365
    Posts
    165

    Active sheet do not print if cell n8 to n15 are blank

    I have a workbook with 6 sheets in it but I want the active sheet Cell n8 to n15 must be filled with any number and can not leave blank. If those cells are are blank then sheet will show message to fill those cells and stop from printing. user should be ok to put zero in it.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Active sheet do not print if cell n8 to n15 are blank

    Hi, robrobet,

    every sheet when itīs active?

    Code goes into ThisWorkbook:
    Please Login or Register  to view this content.
    HTH,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Contributor
    Join Date
    05-01-2013
    Location
    Canada
    MS-Off Ver
    Office 365
    Posts
    165

    Re: Active sheet do not print if cell n8 to n15 are blank

    I also have this for my workbook for each sheet, is there way I can adjust these two togather, I mean to say before print f28 = i41 and cell n8 to n14 can not be blank. and message only pop up if one of the condition not met.

    Thanks for your help

    Private Sub Workbook_BeforePrint(Cancel As Boolean)
    If Worksheets("Sheet1").Range("f28") <> Worksheets("Sheet1").Range("i41") Then
    Cancel = True
    MsgBox "Please check the total amount in F28 (Highlight in Green) match with total I41!"
    End If
    Private Sub Workbook_BeforePrint(Cancel As Boolean)
    If Worksheets("sheet2").Range("f28") <> Worksheets("sheet2").Range("i41") Then
    Cancel = True
    MsgBox "Please check the total amount in F28 (Highlight in Green) match with total I41!"
    End If
    End Sub

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Active sheet do not print if cell n8 to n15 are blank

    Hi, robrobet,

    of course - if you use code-tags around your procedure?

    There may only be one procedure with the Name of Worksheet_BeforePrint in ThisWorkbook:
    Please Login or Register  to view this content.
    First check is between F28 and I41, if they do not match show Message and exit sub.

    Ciao,
    Holger

  5. #5
    Forum Contributor
    Join Date
    05-01-2013
    Location
    Canada
    MS-Off Ver
    Office 365
    Posts
    165

    Re: Active sheet do not print if cell n8 to n15 are blank

    Thanks a lot it does what I want.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1