Djblois
04-12-2010, 08:45 AM
I use this code to fill column headings using an array. However, I use almost the same exact code in multiple places. I would rather the code adjust automatically based on the size of the array is that possible:
Here is some of the code:
Range("A1", Cells(1, FinalColumn(wsWorking) + 2)).Value = Array("Whse#", "Whse", "Lot#", "Item#", "Product", "Dept#", "Received", "Shipped", "Adjusted", _
"In Whse", "Reserved", "Allocated", "Held", "Available", "Value")
see how I take the width of columns then I add values to it if it is not long enough? Well I want it to pick up the size of the array automatically - so I do not need to do this and I can use multiple arrarys in the same code.
Here is some of the code:
Range("A1", Cells(1, FinalColumn(wsWorking) + 2)).Value = Array("Whse#", "Whse", "Lot#", "Item#", "Product", "Dept#", "Received", "Shipped", "Adjusted", _
"In Whse", "Reserved", "Allocated", "Held", "Available", "Value")
see how I take the width of columns then I add values to it if it is not long enough? Well I want it to pick up the size of the array automatically - so I do not need to do this and I can use multiple arrarys in the same code.