SteveM99
10-25-2017, 12:21 PM
Having problems figuring out codes;
Here is regular excel formula:
=IF(glsum!D$29>0,+glsum!D5,+reportsum3!D5)
Here is my code
Dim Lastrow As Long
Lastrow = Worksheets("glsum").Columns("D").Find("*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows, LookIn:=xlValues).Row
Worksheets("reportsum4").Range("d5:d" & Lastrow).Formula = "=IF(glsum!D$" & LastRow & ")"&"">""&0,+glsum!D5,+reportsum3!D5)"
Was trying to insert the last row into the formula in vba (D29 is the last row on sheet GLsum, but it may change, and need to insert the formula in correctly. I am getting confused with the <>" and & parts.
Here is regular excel formula:
=IF(glsum!D$29>0,+glsum!D5,+reportsum3!D5)
Here is my code
Dim Lastrow As Long
Lastrow = Worksheets("glsum").Columns("D").Find("*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows, LookIn:=xlValues).Row
Worksheets("reportsum4").Range("d5:d" & Lastrow).Formula = "=IF(glsum!D$" & LastRow & ")"&"">""&0,+glsum!D5,+reportsum3!D5)"
Was trying to insert the last row into the formula in vba (D29 is the last row on sheet GLsum, but it may change, and need to insert the formula in correctly. I am getting confused with the <>" and & parts.