+ Reply to Thread
Results 1 to 5 of 5

How to make 2 macros work

  1. #1
    Forum Contributor
    Join Date
    09-11-2012
    Location
    minot, north dakota
    MS-Off Ver
    Excel 2010
    Posts
    127

    How to make 2 macros work

    Below I have pasted the 2 macros that i am trying to use. When I added the second macro which is the same as the first one but it is for a different cell erros pop up when i try changing the cell for the second macro. How do i correct this so that the second macro works?
    I am sure it is in the beginning of the notation for the second macro.




    Private Sub worksheet_change(ByVal target As Range)
    If Not Intersect(target, Range("D55")) Is Nothing Then
    Rows("56:65").EntireRow.Hidden = False
    Select Case target
    Case 0
    Rows("56:65").EntireRow.Hidden = True
    Case 1
    Rows("58:65").EntireRow.Hidden = True
    Case 2
    Rows("60:65").EntireRow.Hidden = True
    Case 3
    Rows("62:65").EntireRow.Hidden = True
    Case 4
    Rows("64:65").EntireRow.Hidden = True
    Case 5
    Rows("56:65").EntireRow.Hidden = False
    End Select
    End If
    End Sub

    Private Sub worksheet_change(ByVal target As Range)
    If Not Intersect(target, Range("H78")) Is Nothing Then
    Rows("80:112").EntireRow.Hidden = False
    Select Case target
    Case 0
    Rows("80:112").EntireRow.Hidden = True
    Case 1
    Rows("91:112").EntireRow.Hidden = True
    Case 2
    Rows("103:112").EntireRow.Hidden = True
    Case 3
    Rows("80:112").EntireRow.Hidden = False
    End Select
    End If
    End Sub
    Last edited by aaron061883; 01-05-2013 at 10:17 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,454

    Re: How to make 2 macros work

    I guess:

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: How to make 2 macros work

    Try something like this...

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    09-11-2012
    Location
    minot, north dakota
    MS-Off Ver
    Excel 2010
    Posts
    127

    Re: How to make 2 macros work

    Thanks for all the help it is working like a charm

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,454

    Re: How to make 2 macros work

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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