+ Reply to Thread
Results 1 to 4 of 4

Macro works but not in combination with other macros

Hybrid View

  1. #1
    Registered User
    Join Date
    03-12-2021
    Location
    Vienna
    MS-Off Ver
    2016
    Posts
    6

    Question Macro works but not in combination with other macros

    Dear all,

    i have this macro which filters and copies some information (dpwlöschenkopierenfiltern). It works fine on its own. However as soon as I try to combine it with a diffrent macro (ldplöschenfiltern) it stops working.

    Any help would be greatly appreciated!


    Sub dpwlöschenkopierenfiltern()
    '
    ' dpwlöschenkopierenfiltern Makro
    '
    
    '
        Application.CutCopyMode = False
        Columns("A:H").Select
        Selection.Delete Shift:=xlToLeft
        ActiveSheet.Shapes.Range(Array("Button 1")).Select
        ActiveSheet.Shapes("Button 1").IncrementLeft 750.6
        ActiveSheet.Shapes("Button 1").IncrementTop -10.2
        Columns("B:B").Select
        Selection.Delete Shift:=xlToLeft
        Columns("D:D").Select
        Selection.Delete Shift:=xlToLeft
        Columns("E:G").Select
        Selection.Delete Shift:=xlToLeft
        Columns("D:D").Select
        Selection.AutoFilter
        ActiveSheet.Range("$D$1:$D$136").AutoFilter Field:=1, Criteria1:= _
            "direkte TN/innen-bezogene Leis"
        Columns("A:C").Select
        Selection.Copy
        Sheets("DPW").Select
        Range("A1").Select
        ActiveSheet.Paste
        Sheets("LDP").Select
        
    End Sub
    
    Sub ldplöschenfiltern()
    '
    ' ldplöschenfiltern Makro
    '
    
    '
        Columns("A:A").Select
        Selection.Delete Shift:=xlToLeft
        Columns("D:H").Select
        Selection.Delete Shift:=xlToLeft
        Columns("E:H").Select
        Selection.Delete Shift:=xlToLeft
        Columns("A:D").Select
        Selection.AutoFilter
        ActiveSheet.Range("$A$1:$D$1165").AutoFilter Field:=4, Criteria1:="<>"
        Columns("A:C").Select
        Selection.Copy
        Sheets("LDP mit Nullen").Select
        Range("A1").Select
        ActiveSheet.Paste
        Columns("A:C").Select
        Application.CutCopyMode = False
        Selection.AutoFilter
        ActiveSheet.Range("$A$1:$C$1048408").AutoFilter Field:=3, Criteria1:=">0", _
            Operator:=xlAnd
        ActiveSheet.Range("$A$1:$C$1048408").AutoFilter Field:=2, Criteria1:=">0", _
            Operator:=xlAnd
        Columns("A:C").Select
        Selection.Copy
        Sheets("LDP").Select
        Range("A1").Select
        ActiveSheet.Paste
        Sheets("LDP").Select
        
    'next Macro
    
    End Sub
    Info:

    Windows Version: Microsoft Windows 10 Pro
    Excel Version: Microsoft Office Standard 2016

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: Macro works but not in combination with other macros

    Without the data and so it's difficult to tell, but you say stops working, that is not an explanation.
    WHAT stops?
    Probably the first macro hides all the cells you need in the second macro or v.v.
    I suggest a sample file with non-private data but with the macro's and a clear explanation to help you
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Registered User
    Join Date
    03-12-2021
    Location
    Vienna
    MS-Off Ver
    2016
    Posts
    6

    Re: Macro works but not in combination with other macros

    I solved it! The problem was I didn't activate the sheet! I solved it with Sub ActivateSheet()

  4. #4
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,937

    Re: Macro works but not in combination with other macros

    Well it's always simpler than you think

+ 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] Sort Operation Works when Macros are called manually, but not when VBA calls the Macros
    By lovecolorado in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-18-2019, 02:13 PM
  2. [SOLVED] Email Details to Excel & Save as .MSG on one macro - combination of 2 macros
    By nathandavies9 in forum Outlook Formatting & Functions
    Replies: 0
    Last Post: 03-21-2017, 12:17 PM
  3. Replies: 0
    Last Post: 06-09-2015, 09:39 AM
  4. Combination question for excel and powerpoint macros
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-08-2014, 05:19 PM
  5. Replies: 0
    Last Post: 06-05-2014, 12:44 PM
  6. Developing a Combination of Columns within Excel, using Macros
    By btmeyer in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-26-2008, 11:17 PM
  7. Macros works on one PC but not on another
    By ChrisMattock in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-12-2006, 08:29 AM

Tags for this Thread

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