PC Review


Reply
 
 
Striker3070
Guest
Posts: n/a
 
      29th Apr 2010
I have an array with about 1500 names in it. How can I add those names to
column A1 on sheet1 and go down one cell 1500 times and add the next value
to the spreadsheet? in Excel07 VBA

 
Reply With Quote
 
 
 
 
Striker3070
Guest
Posts: n/a
 
      29th Apr 2010
apologize for duplicate post, seem to have connectivity issues

"Striker3070" <(E-Mail Removed)> wrote in message
news:F0806BFF-7975-4C06-A448-(E-Mail Removed)...
> I have an array with about 1500 names in it. How can I add those names to
> column A1 on sheet1 and go down one cell 1500 times and add the next value
> to the spreadsheet? in Excel07 VBA


 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      29th Apr 2010
Since you're only using about 1500 names, you should be able to plop those names
back into the worksheet in one fell swoop:

Option Explicit
Sub testme()

Dim myArr As Variant
Dim myCell As Range

myArr = Array(1, 2, 3, "abc", "def")

Set myCell = ActiveSheet.Range("A1")

myCell.Resize(UBound(myArr) - LBound(myArr) + 1, 1).Value _
= Application.Transpose(myArr)

End Sub

Some versions of excel (before xl2002???) had trouble with over 7000 elements (I
forget the exact number).

But you could loop with something like:

Option Explicit
Sub testme2()

Dim myArr As Variant
Dim myCell As Range
Dim iCtr As Long

myArr = Array(1, 2, 3, "abc", "def")

Set myCell = ActiveSheet.Range("A1")

For iCtr = LBound(myArr) To UBound(myArr)
myCell.Value = myArr(iCtr)
Set myCell = myCell.Offset(1, 0)
Next iCtr

End Sub


Striker3070 wrote:
>
> I have an array with about 1500 names in it. How can I add those names to
> column A1 on sheet1 and go down one cell 1500 times and add the next value
> to the spreadsheet? in Excel07 VBA


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting native arrays to managed arrays Bob Altman Microsoft VC .NET 8 27th Feb 2008 11:33 PM
Trouble with arrays (transferring values between two arrays) Keith R Microsoft Excel Programming 4 14th Nov 2007 12:00 AM
Jagged Arrays Problem - How to Assign Arrays to an Array Zigs Microsoft Excel Programming 3 11th Apr 2007 01:39 AM
Working with ranges in arrays... or an introduction to arrays =?Utf-8?B?R2xlbg==?= Microsoft Excel Programming 5 10th Sep 2006 08:32 AM
Arrays - declaration, adding values to arrays and calculation Maxi Microsoft Excel Programming 1 17th Aug 2006 04:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:58 AM.