I am creating column headers for a bunch of columns. I would like to do them in one like below - but I couldn't get the syntax right. Can anyone help?
Range("AB1:AE1").Value = ("UnitPriceUSD","TotalCostUSD","UnitPrice", "TotalCost")
Try this.
Dim arr As Variant
arr = Array("UnitPriceUSD", "TotalCostUSD", "UnitPrice", "TotalCost")
Range("AB1:AE1").Value = arr
Or even simpler:
Range("AB1:AE1").Value = Array("UnitPriceUSD", "TotalCostUSD", "UnitPrice", "TotalCost")
[{"a", "b"; "c", "d"}] will create a 2-dimensional array