+ Reply to Thread
Results 1 to 3 of 3

Need to create a macro that will combine 2 other macros plus

Hybrid View

  1. #1
    Registered User
    Join Date
    06-24-2013
    Location
    Reading CA
    MS-Off Ver
    Excel 2010
    Posts
    10

    Need to create a macro that will combine 2 other macros plus

    The attached file has 2 macros. One will print and the other hides rows that equal zero. It is based on the contents in Cell A4 of the sheet called PSFR. What I would like is to run a macro that gets the project number from the Project Run sheet and then runs the hide row macro and then the Print Macro. Is this possible. I have not been able to combine the two existing let alone a third. Any advise you can give me would be greatly appreciated.

    Thanks
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    06-24-2013
    Location
    Reading CA
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Need to create a macro that will combine 2 other macros plus

    I was able to solve this on my own. Please see below for the solution

    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("A4:A4")
        
        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.
            MsgBox "Cell " & Target.Address & " has changed. Press OK to Update"
            
            Application.Run "HideZeroRows"
            Application.Run "Printworkbook"
    Last edited by arlu1201; 07-02-2013 at 02:44 AM.

  3. #3
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Need to create a macro that will combine 2 other macros plus

    rjackson,

    Welcome to the forum.

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. In order to put code tags, either type [CODE] before your code and [/CODE] at the end of it, OR you can highlight your code and click the # icon at the top of your post window.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ 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