Results 1 to 1 of 1
2012-06-14, 16:27 #1
- Join Date
- Feb 2001
- St-Hubert, Qu, Quebec, Canada
- Thanked 0 Times in 0 Posts
Issue - Range.Row in range in formula is offset?
Hi fellow Lounger! I haven't been here in a very long while but I know this is the place, if any where I may find somebody that knows this...
I'm trying to migrate VBA code from Excel 2000 to 2007.
After all the initial issues and building a new Ribbon, I'm now face with one sub that display a behaviour that I can't explain...
Set dst_range = in_wrks_set.dst_wrks.Range("V2", "V" & format(in_rate_parm.maxnum_index)) '<--- This set the range to a column from row 2 to x...
dst_range.Formula = "=generate_Dcode(RC)" ' '<--- This is where the problem arise...
The formula uses the .row of the range (RC) pass to it, to generate a value that is used to link data from two sheets.
Seems that when the formula "generate_Dcode" execute with the col range, the row are offsets in 2007!?!
Instead of executing for row 2,3,4 up to the max row in the range... like in excel 2000, It's executing for row 3,5,7...
Then comes back to do row 2,4,6....
Which in the end generated mismatch between the two sheets.
I have a work around by executing with a FOR ... EACH. But it's way slower. Ex.: 1 sec VS 12 sec average for 2000 rows.
I can't find why it's behaving that way. I've change the .Formula for .FormulaR1C1, but this did not change anything.
Thanks in advance and any help would be appreciated.