Consulting

Results 1 to 7 of 7

Thread: I can not activate these two macros together

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Tutor
    Joined
    Sep 2012
    Location
    London
    Posts
    272
    Location

    I can not activate these two macros together

    Hello
    can anyone tell me why I can not activate these two macros together?
    Sub macros2222223()
    
    HideUnhideColumns
    HideUnhideRows
    End Sub 'not working
    
    Sub HideUnhideColumns()
        Dim myBTN As Button, cll As Range
         
        With ActiveSheet
            Set myBTN = .Buttons(Application.Caller)
            If Trim(UCase(myBTN.Caption)) = "HIDE" Then
                 
                For Each cll In .Range("Sum").Cells
                    cll.EntireColumn.Hidden = cll.Value = 0
                Next cll
                 
                myBTN.Caption = "Show"
                 
            Else
                .Range("Sum").EntireColumn.Hidden = False
                 
                myBTN.Caption = "Hide"
            End If
            On Error Resume Next
            .UsedRange.Cells.SpecialCells(xlCellTypeVisible).EntireColumn.AutoFit
            On Error GoTo 0
        End With
    End Sub
    
    
    
    
    Sub HideUnhideRows()
        Dim myBTN As Button, cll As Range
         
        With ActiveSheet
            Set myBTN = .Buttons(Application.Caller)
            If Trim(UCase(myBTN.Caption)) = "HIDE" Then
                 
                For Each cll In .Range("Num").Cells
                    cll.EntireRow.Hidden = cll.Value = ""
                Next cll
                 
                myBTN.Caption = "Show"
                 
            Else
                .Range("Num").EntireRow.Hidden = False
                 
                myBTN.Caption = "Hide"
            End If
            On Error Resume Next
            .UsedRange.Cells.SpecialCells(xlCellTypeVisible).EntireRow.AutoFit
            On Error GoTo 0
        End With
    End Sub
    Sub CallprobMacs()
    
    Call HideprobUnhideColumns
        Call HideprobUnhideRows
    End Sub 'not working

    Sub runall1()
    
    Application.Run "HideUnhideColumns"
    Application.Run "HideUnhideRows"
    End Sub 'not working
    Attached Files Attached Files
    Last edited by k0st4din; 10-22-2013 at 10:25 PM.

Posting Permissions

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