I am currently stuck trying to build a button that will run a sumifs macro. I am trying to build the button in Sheet1 and have the sumifs execute on Sheet2. What I currently have is:
Option Explicit
Sub Sumifs()
    Dim Sht2 As Worksheet
    Dim EndRow As Long
    Dim i As Integer
    Dim SumRange As Range
    Dim CrtA As Range
    Dim CrtB As Range
    With Sht1
        EndRow = Cells(Rows.Count, "A").End(xlUp).Row
    End With
    Set Sht2 = Worksheets("Sheet2")
    Set SumRange = Worksheets("Sheet3").Range("L5:L10")
    Set CrtA = Worksheets("Sheet3").Range("C5:C10")
    Set CrtB = Worksheets("Sheet3").Range("K5:K10")
    For i = 5 To EndRow
        sht2.Cells(i, 4) = WorksheetFunction.SumIfs(SumRange, crtA, Range("G" & i), crtB, Range("B" & i))
    Next i
End Sub
I have tried running it with alt + F8 and it works great as long as I am in Sheet2, if I try running it on Sheet1 nothing happens. 
Also, is there a way to link the sumifs criteria to a separate worksheet? Specifically, I am trying to have Range ("B" & 1) be linked to a cells J5:J10 on Sheet3. Currently, I get a type error whenever I try 
worksheets("sheet3").range ("B" & 1)
Really appreciate any advice you can provide. Thanks
 
     
    
