wayneryeven
Technical User
Hey all
I have written the following code:
Range("k2").Select
ActiveCell.FormulaR1C1 = "=IF(ISNA(VLOOKUP(RC[-2],ActualProduction,2,FALSE)),0,(VLOOKUP(RC[-2],ActualProduction,2,FALSE)))"
ActiveCell.Value = ActiveCell.Value
' go to next row...
ActiveCell.Offset(1, 0).Select
Next i
Essentially what this does is loop through each row and perform a lookup, then place the VALUE of this lookup in the cell (Thanks PHV for help on this).
Now, there MAY already be a value in the cell to begin with, so what i wish to do is the following:
Read the value in the cell and copy to a variable aBalance
Perform the lookup and either a) copy the value to the cell or b) write the lookup result to the variable aProd
Then sum the two variables aBalance+aProd and write the answer to the Active Cell.
I have the lookup working. However i cant seem to get it to read the value in first for each loop.
Has anyone any ideas or pointers?
All help greatly appreciated.
I have written the following code:
Range("k2").Select
ActiveCell.FormulaR1C1 = "=IF(ISNA(VLOOKUP(RC[-2],ActualProduction,2,FALSE)),0,(VLOOKUP(RC[-2],ActualProduction,2,FALSE)))"
ActiveCell.Value = ActiveCell.Value
' go to next row...
ActiveCell.Offset(1, 0).Select
Next i
Essentially what this does is loop through each row and perform a lookup, then place the VALUE of this lookup in the cell (Thanks PHV for help on this).
Now, there MAY already be a value in the cell to begin with, so what i wish to do is the following:
Read the value in the cell and copy to a variable aBalance
Perform the lookup and either a) copy the value to the cell or b) write the lookup result to the variable aProd
Then sum the two variables aBalance+aProd and write the answer to the Active Cell.
I have the lookup working. However i cant seem to get it to read the value in first for each loop.
Has anyone any ideas or pointers?
All help greatly appreciated.