Hi
I struggle with syntax and punctuation in writing a formula to a cell using variables.
I have this codeWhere![]()
Range(ColLetter & LastRow).Formula = "=SUMIF($B6:$B:" & LastRow - 2 & ",""Subtotal""" _ & "," & ColLetter & "6:" & ColLetter & LastRow - 2 & ") """
Dim LastRow As Long
Dim ColLetter As String
ColLetter returns E
LastRow returns 38
and LastRow -2 would be 36
This is the result I'm looking forI get run time error 1004 "Application defined or Object defined error". I've been wrestling with this for the last 4 hours and can't seem to get the syntax correct. Your help in showing me where I'm going wrong will be greatly appreciated.![]()
Range("E38").Formula = "=sumif($B6:$B36,""Subtotal"",E6:E36)"
John
Bookmarks