Thread: Populate array
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Populate array

Beto,

That works, but I added the bits about lower and upper array bounds as you
said you wanted to learn more VBA <G.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Beto" wrote in message
...
Beto wrote:

Jake Marx wrote:

Hi Beto,

You could do something like this:

Sub test()
Dim Names As Variant

Names = Array("N1", "N2", "N3")

Sheets("Sheet1").Range("A1:C1").Value = Names
End Sub


Worked beatifully... Is there a way to assign comlumn widths in a
similar way?


Nevermind, after a lot of trial & error I came up with this:

Dim vColumnWidths as Variant

vColumnWidths = Array(10, 20, 30)
Range("A1:C1").ColumnWidth = vColumnWidths

Regards,
--
Beto
Reply: Erase between the dot (inclusive) and the @.
Responder: Borra la frase obvia y el punto previo.