#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default arrays

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default arrays

apologize for duplicate post, seem to have connectivity issues

"Striker3070" wrote in message
...
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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default arrays

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Arrays Bob[_77_] Excel Programming 3 June 20th 08 01:12 PM
Trouble with arrays (transferring values between two arrays) Keith R[_2_] Excel Programming 4 November 14th 07 12:00 AM
Working with ranges in arrays... or an introduction to arrays Glen Excel Programming 5 September 10th 06 08:32 AM
Arrays - declaration, adding values to arrays and calculation Maxi[_2_] Excel Programming 1 August 17th 06 04:13 PM
Arrays ryan wells Excel Programming 1 June 13th 04 06:20 AM


All times are GMT +1. The time now is 03:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"