Incremental Variable Names

FIFARay007

Board Regular
Joined
Jan 7, 2008
Messages
111
Quick question....

I'm using a For...Next loop and was hoping I could use it to change the variable name as well. What I have is below...

Code:
    For i = 1 To 11
        
        opt & i = EssVGetGlobalOption(i)
      
        
    Next i

What I'd like is to populate "opt1", "opt2", "opt3", etc. with the results of that function. Is this possible?
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
creating a variable of ARRAY would be a more logical solution
 
Upvote 0
if you are not familiar with arrays, this might give you an idea

Code:
Sub test()
Dim x(3) As Integer 'Create an array that can hold 3 integer values

'Populate the array with 10, 20, and 30
For i = 1 To 3
    x(i) = i * 10
Next i

'Display the values one by one
For i = 1 To 3
    MsgBox x(i)
Next i
End Sub

also, you can do a little research within this forum for more valuable information
 
Upvote 0

Forum statistics

Threads
1,214,793
Messages
6,121,619
Members
449,039
Latest member
Mbone Mathonsi

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top