xcaliber13 Posted February 6, 2020 Posted February 6, 2020 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
Moderators JLogan3o13 Posted February 6, 2020 Moderators Posted February 6, 2020 (edited) 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 February 6, 2020 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!
Subz Posted February 6, 2020 Posted February 6, 2020 Shouldn't it be: _Excel_RangeWrite($oWorkbook, Default, "=SUM(D2:D"& $iLastRow & ")", "D" & $iNextRow)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now