PC Review


Reply
Thread Tools Rate Thread

Call Variables by String

 
 
Thomas [PBD]
Guest
Posts: n/a
 
      15th Jul 2008
What I would like to do is be able to call "acard" variable by combining cc1
& "card". Any suggestions? cc1's value would return "a", therefore creating
"acard", which I would like to use to call the variable acard, and place the
value of acard into a cell.

For x = 1 To Range("Players").Value
acard = Range("P" & x & "Card1").Cells(1, 2).Value
asuit = Range("P" & x & "Card1").Cells(1, 3).Value
bcard = Range("P" & x & "Card2").Cells(1, 2).Value
bsuit = Range("P" & x & "Card2").Cells(1, 3).Value
ccard = Range("River_Cards").Cells(1, 2).Value
csuit = Range("River_Cards").Cells(1, 3).Value
dcard = Range("River_Cards").Cells(2, 2).Value
dsuit = Range("River_Cards").Cells(2, 3).Value
ecard = Range("River_Cards").Cells(3, 2).Value
esuit = Range("River_Cards").Cells(3, 3).Value
fcard = Range("River_Cards").Cells(4, 2).Value
fsuit = Range("River_Cards").Cells(4, 3).Value
gcard = Range("River_Cards").Cells(5, 2).Value
gsuit = Range("River_Cards").Cells(5, 3).Value
For z = 1 To 21
cc1 = Range("Combinations").Cells(z, 1).Value
cc2 = Range("Combinations").Cells(z, 2).Value
cc3 = Range("Combinations").Cells(z, 3).Value
cc4 = Range("Combinations").Cells(z, 4).Value
cc5 = Range("Combinations").Cells(z, 5).Value
Range("Calc_Cards").Cells(1, 2).Value = cc1 & "card"

--
--Thomas [PBD]
Working hard to make working easy.
 
Reply With Quote
 
 
 
 
Thomas [PBD]
Guest
Posts: n/a
 
      15th Jul 2008
Answered my own question:

For x = 1 To Range("Players").Value
Dim card(1 To 7) As String
Dim suit(1 To 7) As String

card(1) = Range("P" & x & "Card1").Cells(1, 2).Value
suit(1) = Range("P" & x & "Card1").Cells(1, 3).Value
card(2) = Range("P" & x & "Card2").Cells(1, 2).Value
suit(2) = Range("P" & x & "Card2").Cells(1, 3).Value
card(3) = Range("River_Cards").Cells(1, 2).Value
suit(3) = Range("River_Cards").Cells(1, 3).Value
card(4) = Range("River_Cards").Cells(2, 2).Value
suit(4) = Range("River_Cards").Cells(2, 3).Value
card(5) = Range("River_Cards").Cells(3, 2).Value
suit(5) = Range("River_Cards").Cells(3, 3).Value
card(6) = Range("River_Cards").Cells(4, 2).Value
suit(6) = Range("River_Cards").Cells(4, 3).Value
card(7) = Range("River_Cards").Cells(5, 2).Value
suit(7) = Range("River_Cards").Cells(5, 3).Value
For z = 1 To 21
cc1 = Range("Combinations").Cells(z, 1).Value
cc2 = Range("Combinations").Cells(z, 2).Value
cc3 = Range("Combinations").Cells(z, 3).Value
cc4 = Range("Combinations").Cells(z, 4).Value
cc5 = Range("Combinations").Cells(z, 5).Value
Range("Calc_Cards").Cells(1, 2).Value = card(cc1)

--
--Thomas [PBD]
Working hard to make working easy.


"Thomas [PBD]" wrote:

> What I would like to do is be able to call "acard" variable by combining cc1
> & "card". Any suggestions? cc1's value would return "a", therefore creating
> "acard", which I would like to use to call the variable acard, and place the
> value of acard into a cell.
>
> For x = 1 To Range("Players").Value
> acard = Range("P" & x & "Card1").Cells(1, 2).Value
> asuit = Range("P" & x & "Card1").Cells(1, 3).Value
> bcard = Range("P" & x & "Card2").Cells(1, 2).Value
> bsuit = Range("P" & x & "Card2").Cells(1, 3).Value
> ccard = Range("River_Cards").Cells(1, 2).Value
> csuit = Range("River_Cards").Cells(1, 3).Value
> dcard = Range("River_Cards").Cells(2, 2).Value
> dsuit = Range("River_Cards").Cells(2, 3).Value
> ecard = Range("River_Cards").Cells(3, 2).Value
> esuit = Range("River_Cards").Cells(3, 3).Value
> fcard = Range("River_Cards").Cells(4, 2).Value
> fsuit = Range("River_Cards").Cells(4, 3).Value
> gcard = Range("River_Cards").Cells(5, 2).Value
> gsuit = Range("River_Cards").Cells(5, 3).Value
> For z = 1 To 21
> cc1 = Range("Combinations").Cells(z, 1).Value
> cc2 = Range("Combinations").Cells(z, 2).Value
> cc3 = Range("Combinations").Cells(z, 3).Value
> cc4 = Range("Combinations").Cells(z, 4).Value
> cc5 = Range("Combinations").Cells(z, 5).Value
> Range("Calc_Cards").Cells(1, 2).Value = cc1 & "card"
>
> --
> --Thomas [PBD]
> Working hard to make working easy.

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Call Variables by String Thomas [PBD] Microsoft Excel Programming 0 15th Jul 2008 01:20 PM
Cant call stored procedure which uses table variables? Sunny Microsoft Access 5 11th Jan 2007 02:10 PM
call procedures in a Subform using variables =?Utf-8?B?VGlhZ28gUGludG8=?= Microsoft Access Form Coding 11 16th Feb 2005 02:30 PM
call VLOOKUP from Macro with Variables banavas Microsoft Excel Programming 3 23rd Jun 2004 07:36 PM
asynchronous call back and session variables..... Ollie Microsoft ASP .NET 6 19th Mar 2004 06:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:10 PM.