cvilla7174
04-30-2019, 11:34 AM
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?
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?