Consulting

Results 1 to 3 of 3

Thread: Sumif not working

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Sumif not working

    Hello , I am trying to do a sumif but the problem is what if i try to use the sheet code name it won't work, only if i use the sheet name, here is what i mean by that


    sumifmacro Macro
    Range("E4").Select
     ActiveCell.FormulaR1C1="=SUMIF('ancma 4-7-2019'!R3C2:R173C2,april!RC9,'ancma 4-7-2019'!R3C5:R173C5)"
    Range("E5").Select
    End Sub
    now if I use the same formula but trying to use the sheet codename it doesn't work why?

    Sub mysumif()
    Range("E4").Select
    ActiveCell.FormulaR1C1 = "=sumif('sheet56'!R3C2:R173C2,sheet57!RC9,'sheet56'!R3C5:R173C5)"
    Range("E5").Select
    End Sub
    
    now is there a way to use a variable that I can create to reference either the worksheet name or code name as variables?
    Last edited by Aussiebear; 04-27-2023 at 12:25 PM. Reason: Reduced the whitespace

Posting Permissions

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