VBA- How to point string to array value

Mr.FutureCoder

New Member
Joined
Aug 2, 2011
Messages
10
Hi,
As shown below, What I am trying to is

sub array1()

Dim sName as string
Dim commodity(3) as string
Dim NG_DJ(3) as string


commodity(1)="NG"
commodity(2)="CL"
commodity(3)="HO"

NG(1) = "03": NG(2) = "05": NG(3) = "07"
CL(1) = "01": CL(2) = "02": CL(3) = "03"
HO(1) = "06": HO(2) = "08": HO(3) = "10"

'**Here is the problem**'

sName= commodity(1) (1)

end sub

Output of the sName should be "03" as commodity(1) is "NG" and then it should take NG(1) and retrieve the "03". Any help would be appreciated highly. Thanks.
 
yes...actually using string value of one array as array name to recall another values array...
example:-first array is commodity(1)="NG", then second array is NG(1)="01". so i want to call value "01" from first array.
 
Upvote 0

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Forum statistics

Threads
1,224,599
Messages
6,179,827
Members
452,946
Latest member
JoseDavid

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