View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Loop with variable name?

A small correction

Use an array.

Dim arrPI
Dim intTemp

arrPI = Array("a","b","c","d")
For intTemp = 0 to Ubound(arrPI)
Msgbox arrPI(intTemp)
Next


If you want to assign variables at run time declare

Dim arrPI(10) as Variant
arrPI(0) = "Something0"
arrPI(1) = "Something1"
arrPI(2) = "Something2"
arrPI(3) = "Something2"
..
upto (You can store a max of 11 variables in this array)
arrPI(10) = "Something10"


If this post helps click Yes
---------------
Jacob Skaria