felkin
Chemical
- Feb 5, 2004
- 4
I am new to VBA and Excel and can't figure out how to loop through ranges. Basically, I have a calculation that takes two values (actually alot more but for example...) and returns one. I want to input the two values from two ranges and output to another range.
'input variable values
rangeA = Range(RefEdit1.Text)
rangeB = Range(RefEdit1.Text)
'output location
rangeC = Range(RefEdit1.Text)
'then I need to start a loop
For Each cell In ???
RangeC.Cell.Value = Function(rangeA.Cell.Value,rangeB.Cell.Value)
Next cell
Please help me with this syntax!!! I think that I could figure it out with some example code but I have been having a hard time finding example code for this.
Thanks,
Rob
'input variable values
rangeA = Range(RefEdit1.Text)
rangeB = Range(RefEdit1.Text)
'output location
rangeC = Range(RefEdit1.Text)
'then I need to start a loop
For Each cell In ???
RangeC.Cell.Value = Function(rangeA.Cell.Value,rangeB.Cell.Value)
Next cell
Please help me with this syntax!!! I think that I could figure it out with some example code but I have been having a hard time finding example code for this.
Thanks,
Rob