Jump to content

Excel RangeWrite Formula help(Solved)

Recommended Posts

Hello everyone

      I am having a hard time to figure out the correct syntax for an excel formula.  I use 

Global $iLastRow = $oWorkBook.ActiveSheet.UsedRange.Rows.Count
Global $iNextRow = $oWorkBook.ActiveSheet.UsedRange.Rows.Count + 2

as my variables.  

This works

_Excel_RangeWrite($oWorkbook, Default, "=SUM(D2:D136)", "D" & $iNextRow)

But I want to use $iLastRow in the formula 

_Excel_RangeWrite($oWorkbook, Default, "=SUM(D2:D"& $iLastRow)"", "D" & $iNextRow)

This is just one example of the many different ways I have tried to get this to work without getting a syntax error.  What am I doing wrong?  Thank you

Share this post

Link to post
Share on other sites

In your second snippet, why the double "" after $iLastRow?

Edit: Nevermind, I see it now, I would try something like 

"=SUM(D2:D"& $iLastRow & ")"


Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...