VBA Array element changes by itself!

ExcelMarc

New Member
Joined
Oct 4, 2011
Messages
6
Using Excel 2007. Just started learning VB a few months ago and stuck on this one: I have 1 workbook with 3 worksheets. 2 worksheets have large tables of data (>60 cols x >5000 rows). I am writing a VBA array (9 elements in total) to write formulas into cells on one worksheet, and part of the formula is making reference to cells on the other worksheet. For ex in worsheet called OLD_MIF I have:
Dim List as Variant
List = Array(...."IF(ISERROR(MATCH(F2,NEW_MIF!F:F,0)),0,1)", "IF(ISERROR(MATCH(G2,NEW_MIF!G:G,0)),0,2)"....)
However when VB writes these formulas into the cells (in sheet OLD_MIF) Excel changes the "NEW_MIF!F:F" reference to "NEW_MIF!S:S" and the "NEW_MIF!G:G" to "NEW_MIF!T:T".
I tried many things but keep getting the exact same result!
Any help would be greatly appreciated. Thanks :o)
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Showing us the actual macro code that writes to the cells would be a start.
 
Upvote 0
Glenn, thank you for your post. I found a workaround about 5 minutes ago but I might still post more details when I have a chance as I would love to understand why I was having this problem. I'm new in this forum (or any other forum for that matter - as if my "post count of 1" didn't already give that away:biggrin:) so I have to read more about how to post codes and attach files, etc.
Basically my problem seems to be caused by my VB code inserting columns at the start of my data table (in both sheets) plus I had some code to search for 5 specific column headers in each table, cut the entire column and paste them at the start of my table as well.
I rewrote my code so that I have no more "inserting" and now my formulas are correct :)
 
Upvote 0

Forum statistics

Threads
1,224,590
Messages
6,179,750
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top