![]() |
Lists
How do I create a list?
In python, it is: variable = [1,2,3,4] Thanks, mb |
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 |
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 |
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 |
All times are GMT +1. The time now is 08:59 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com