![]() |
VBA ln function
I have this code that I have put together and it works fine as long as none
of my numbers are "0's" or blank cells. 'Inserts A Header and formula Range("AU2").Select ActiveCell.FormulaR1C1 = "A" Range("AU3").Select ActiveCell.FormulaR1C1 = _ "=EXP(INDEX(LINEST(LN(RC[-25]:RC[-15]),R1C22:R1C32),1,2))" 'Inserts B Header and formula Range("AV2").Select ActiveCell.FormulaR1C1 = "B" Range("AV3").Select ActiveCell.FormulaR1C1 = "=INDEX(LINEST(LN(RC[-26]:RC[-16]),R1C22:R1C32),1)" In my spreadsheet I have values from $V$1:$AF$1 (always constant) which are my X values, V3:AF3 are my Y values. The formula works great as long as there are no 0's or blank cells, I have tried to work around this in terms of HLOOKUP and VLOOKUP but it has become more troublesome than its worth. Is there a way to code this so that if there is a blank value that it will ignore the 0 or blank and the coresponding X value (from $V$1:$AF$1). The reason the formula messes up when there is a 0 or blank cell is that you cannot take the ln(0) or a blank cell. Thank you for your help. |
All times are GMT +1. The time now is 07:28 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com