Basically I am trying to build a cheesy slot machine simulator lol. I am having trouble figuring out the code that will compare the range ("B2:D2") to("B3:D3") and then compare ("B3:D3") to ("B4:D4") and finally ("B2:D2") to ("B4:D4"). If any are the same then they win. I have tried:
dim bl as range, cl as range, dl as range, ai as range, Winner as Integer <-- this is dependent on the amount of the bet
set bl = activesheet.range("B2:D2")
set cl = activesheet.range("B3:D3")
set dl = activesheet.range("B4:D4")
if bl = cl then ai.value = ai.value + (Winner*2)<---Here I get the error object variable or with block variable not set
if cl = dl then ai.value = ai.value + (Winner*2)
if dl = bl then ai.value = ai.value + (Winner*2)
I also tried:
for each cell in activesheet.range("b2:b3")
if cell.value = 1 then j = 1
if cell.value = 2 then k = 2
if cell.value = 3 then l = 3 etc...
if j = k then ai.value = ai.value + (Winner*2) and so on...I don't remember the error I got but I want to say it was similar...
Im guessing you just cant take a group of cells and test them this way...any help would be appreciated.
dim bl as range, cl as range, dl as range, ai as range, Winner as Integer <-- this is dependent on the amount of the bet
set bl = activesheet.range("B2:D2")
set cl = activesheet.range("B3:D3")
set dl = activesheet.range("B4:D4")
if bl = cl then ai.value = ai.value + (Winner*2)<---Here I get the error object variable or with block variable not set
if cl = dl then ai.value = ai.value + (Winner*2)
if dl = bl then ai.value = ai.value + (Winner*2)
I also tried:
for each cell in activesheet.range("b2:b3")
if cell.value = 1 then j = 1
if cell.value = 2 then k = 2
if cell.value = 3 then l = 3 etc...
if j = k then ai.value = ai.value + (Winner*2) and so on...I don't remember the error I got but I want to say it was similar...
Im guessing you just cant take a group of cells and test them this way...any help would be appreciated.