LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Sequential variables (no array)


There is nothing built into VBA that will let you do as you ask.


One way, if variables names must beginning with underscore char (to avoid problems with cell names) is to use "named ranges":

Sub createNames()
'run only one time

Dim j As Long

For j = 1 To 100
ThisWorkbook.Names.Add Name:="_aa" & j, RefersTo:=0, Visible:=False
Next

End Sub

Sub writeNames()
Dim j As Long

'run only one time
For j = 1 To 100
ThisWorkbook.Names("_aa" & j).RefersTo = 9
Next


End Sub

Sub readNames()
Dim j As Long

'run only one time
For j = 1 To 10
Debug.Print Application.Evaluate(ThisWorkbook.Names("_aa" & j).RefersTo)
Next


End Sub
 
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
clearing array variables and using an array to determine min value NDBC Excel Programming 7 September 4th 09 09:43 PM
Array variables xavi garriga Excel Programming 3 February 21st 09 11:28 PM
Creating sequential variables on the fly ForestRamsey Excel Programming 3 November 16th 05 08:11 AM
How can I create an array formula for non-sequential cells Sue Excel Worksheet Functions 7 May 21st 05 02:32 PM
Non-sequential VLOOKUP function -OR- sequential sort of web query Eric S Excel Worksheet Functions 1 February 28th 05 07:50 PM


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

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

About Us

"It's about Microsoft Excel"