Hi, A bit of an update again:.....
_.. I wanted to try out getting the data from the large data File (“NutritionalValues2016.xlsx”
) from it whilst closed to see if that helped.
To make a good comparison for that, I thought I would first re do the comparison between the Array Code and the simple spreadsheet interaction code. The reason for this being as , depending on which method I chose in the closed Workbook case it may compare better with one or the other.
_. To recap: My original Code uses Arrays in the main looping “down” all rows in the data File (“NutritionalValues2016.xlsx” ) . These are three captured long single “column” Arrays from the three columns J K and N representing Food Products , Nutrient Names and Nutrition Values. The various comparisons are then done in the main Loopings from Rem4) in which a long one Dimensional Array is produced at the middle of the looping_.....
990 Let arrDBlxRow(MtchHed) = arrNutValues(JayRow - 2) ' Value of Found Nutrition is put in Array for output at the position of the matched Nutritional Heading Name
_........
___ For every output row in the output workbook, “BDSept2016.xlsx” , that Array of the sorted order “row” is pasted out
1080 Let wsDBlx.Range("K" & rDBlx & "").Resize(1, UBound(arrDBlxRow())).Value = arrDBlxRow() 'We may assign a 1 D Array as "pseudo" Horizontal
_......
_._________
Then
_. A simple spreadsheet interaction code does away with the data Arrays, and the final 1 D output Arrays. Direct progression and interaction is done going down the data Worksheet, similar looping is done to find each position of every Nutrition Value in the Output Worksheet, and each matched value is pasted then directly into the Output Worksheet.
Average Results: ( row number pasted out before code "bombs out" )
Sub USDAToDBArraysThirdWB() '---------------- 348
Sub USDAToDBSpreadsheetThirdBook() '--------- 374
_ A little difference, probably the difference between having or not the three long column Arrays..
_...
_ Codes ( given in two parts to fit in Post, but both parts a single code – second part to be copied directly under the first in the same Code Module )
Sub USDAToDBArraysThirdWB()
http://www.excelforum.com/showthread...t=#post4482934
http://www.excelforum.com/showthread...t=#post4482937
Sub USDAToDBSpreadsheetThirdBook()
http://www.excelforum.com/showthread...t=#post4482938
http://www.excelforum.com/showthread...t=#post4482939
Codes in File "MacrosOnly.xlsm" attatched
_....................................
Next post gets on with the closed Workbook idea......
Bookmarks