Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 20th, 2014, 01:26 PM
Registered User
 
Join Date: Nov 2014
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default VBA Assigning Array elements to Range

I am using a dictionary to populate key and array of elements.
Example d. Add "Jan", "2,3,29"

ws.Range("B2:D2").Resize(d.count, 1).value = WorksheetFunction.Transpose(d.Items)

I want to populate the three array elements in B2, C2 and D2; B3, C3 and D3 so on...

When I use the above mentioned code.
Only B2 column is populated with 2,3,29; whereas C2 and D2 are empty. How do I specify that array elements are comma separated and needs to be populated in range of B2:D2?

Thanks,
Vdojo
 
Old November 20th, 2014, 09:35 PM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

In VB you need to have this as three Add statements (http://msdn.microsoft.com/en-us/libr...(v=vs.84).aspx)

Try if it works for you

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel vba, assigning a Name to a sheet stepdev Excel VBA 3 October 31st, 2015 07:32 AM
Problem assigning my Array values to rows - Please Edoloto Excel VBA 1 August 18th, 2008 04:13 AM
Create XML file - add elements according to range remya1000 XML 5 October 3rd, 2007 02:50 PM
Array, Subscript out of range. koss77 VB How-To 4 August 21st, 2006 09:35 AM
Assigning value to array within array janise Beginning VB 6 23 January 11th, 2005 11:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.