+ Reply to Thread
Results 1 to 2 of 2

Stop sheet vb code to run a print vb code.

Hybrid View

Excelnoub Stop sheet vb code to run a... 01-20-2014, 03:07 PM
Excelnoub Re: Stop sheet vb code to run... 01-20-2014, 03:14 PM
  1. #1
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Stop sheet vb code to run a print vb code.

    Good day,
    I am lost and would need the following code as I have tried something by stoping the Private Sub command but didn't do nothing...

    I have a print Userform:

    Private Sub CommandButton1_Click()
        Application.ScreenUpdating = False
        
        msg = MsgBox("This will print Pre-GETS, GETS, Evaluation and Report sheet. Continue?", _
        vbYesNo + vbQuestion + vbSystemModal, "Print all Sheets?")
        
        If msg = vbYes Then
        
            Sheets("Pre-Solicitation").Select
            Range("C:C,D:D,E:E,F:F,G:G").EntireColumn.Hidden = False
            ActiveSheet.PrintOut Copies:=1, Collate:=True
            Range("C:C,D:D,E:E,F:F,G:G").EntireColumn.Hidden = True
            
            Sheets("GETS").Select
            ActiveWindow.SelectedSheets.PrintOut Copies:=1
            
            Sheets("Evaluation").Select
            ActiveWindow.SelectedSheets.PrintOut Copies:=1
            
            Sheets("Report").Select
            ActiveWindow.SelectedSheets.PrintOut Copies:=1
            
            Sheets("Pre-Solicitation").Select
            Range("A5").Select
        
        Application.ScreenUpdating = True
        Unload Me
        Exit Sub
        
        If msg = vbNo Then Exit Sub
        End If
    End Sub
    Pretty simple righ. But when I get to my Sheet5(Report) I need the following code to stop in it's entirety...

    Private Sub Worksheet_Activate()
        Set rng = Range("V5:V100") 
        Application.EnableEvents = False
        For Each cl In rng
            If IsDate(cl.Value) And CDate(cl.Value) <= Date Then
                MsgBox ("Delivery follow up on file " & Range("N" & cl.Row) & " " & Range("O" & cl.Row))
            End If
        Next cl
        Application.EnableEvents = True 
    End Sub
    I would I write this code...

    When the print on sheet5 my code runs and don't even print.

    Please help

  2. #2
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Re: Stop sheet vb code to run a print vb code.

    Never mind i just figured out that I was missing Application.EnableEvents = False

    :D

    Thank you

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How to stop a code from running using an another code/macro
    By danjim02 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-06-2013, 08:21 AM
  2. [SOLVED] Code Efficiency: Stop from looking all the way to the bottom of sheet
    By mlegge04 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-03-2012, 01:12 PM
  3. [SOLVED] VBA Code (colums to row, autofill) stop working in row 294 when new cable code appear
    By sknifseht in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-29-2012, 05:27 AM
  4. [SOLVED] VBA code to print out certain area in a sheet
    By imran91 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-15-2012, 05:16 PM
  5. [SOLVED] how to stop running vba code without loosing printed data on the sheet?
    By MCM in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-17-2006, 05:10 AM

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