#1   Report Post  
Posted to microsoft.public.excel.programming
mb mb is offline
external usenet poster
 
Posts: 10
Default Lists

How do I create a list?

In python, it is: variable = [1,2,3,4]

Thanks,
mb


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

I am unfamiliar with Python, perhaps someone else will post who is, but
judging by your example, I think the nearest equivalent may be called an
Array?

Here is a brief example, but you should read about them in help:

Sub testthis()

Dim vData As Variant
Dim lX As Long
vData = Array("Dog", "Monkey", "Horse", "Rat")

For lX = 1 To UBound(vData)
MsgBox vData(lX)
Next lX

End Sub


"mb" wrote:

How do I create a list?

In python, it is: variable = [1,2,3,4]

Thanks,
mb



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

An array???

dim myArray as variant
myarray = array(1,2,3,4)



mb wrote:

How do I create a list?

In python, it is: variable = [1,2,3,4]

Thanks,
mb


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 225
Default Lists

The index for an array in VB(A) starts from zero (usually..),
so that should be:

For lX = 0 To UBound(vData)

or, in general:

For lX = LBound(vData) To UBound(vData)


Andrew Taylor


quartz wrote:
I am unfamiliar with Python, perhaps someone else will post who is, but
judging by your example, I think the nearest equivalent may be called an
Array?

Here is a brief example, but you should read about them in help:

Sub testthis()

Dim vData As Variant
Dim lX As Long
vData = Array("Dog", "Monkey", "Horse", "Rat")

For lX = 1 To UBound(vData)
MsgBox vData(lX)
Next lX

End Sub


"mb" wrote:

How do I create a list?

In python, it is: variable = [1,2,3,4]

Thanks,
mb




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
Drop down lists from multiple source lists RoofIL Excel Worksheet Functions 3 February 18th 10 09:44 PM
LISTS- adding info without repeat to other lists Jemimastar Excel Discussion (Misc queries) 1 December 1st 06 09:29 PM
Multiple lists with repeated values for dependet drop down lists mcmanusb Excel Worksheet Functions 1 September 29th 06 12:13 AM
Comparing Lists to Partial Lists depuyus[_7_] Excel Programming 0 August 5th 04 01:43 PM
Form lists influencing other lists chanteribby Excel Programming 1 November 6th 03 03:39 AM


All times are GMT +1. The time now is 01:05 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"