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

Link to comment
Share on other sites

  • Moderators

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!

Link to comment
Share on other sites

  • xcaliber13 changed the title to Excel RangeWrite Formula help(Solved)

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...