Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'for all Excellers out there,, this is actually VBA...
- 'copy and paste into new module in new Excel workbook, then click inside startgame sub and push run... then Follow directions...
- 'for full version with simulator and 4 different strategies go to:
- 'https://www.etsy.com/shop/ExcelByActorkitten
- 'would still like to know if it works on Apple computer...
- '''youtube https://www.youtube.com/watch?v=-2O8IMHLApE
- '''rumble https://rumble.com/v2figrw-blackjack-pro.html
- Option Explicit
- Public answer As String, aces As Long, myImage As Shape, bCard As String, cCard As String, cRow As Long, cCol As Long
- Sub startgame()
- ' startGame Macro
- Sheets.Add after:=ActiveSheet
- ActiveSheet.Name = "play"
- ActiveWindow.Zoom = 110
- Range("B1").Select
- ActiveCell.FormulaR1C1 = "H17--->"
- Range("B2").Select
- ActiveCell.FormulaR1C1 = "peek"
- Range("B3").Select
- ActiveCell.FormulaR1C1 = "ins"
- Range("B4").Select
- Selection.Font.Underline = xlUnderlineStyleSingle
- Range("B4").Select
- ActiveCell.FormulaR1C1 = "House"
- Range("E1").Select
- Selection.Font.Underline = xlUnderlineStyleSingle
- ActiveCell.FormulaR1C1 = "Player 1"
- Range("I1").Select
- Selection.Font.Underline = xlUnderlineStyleSingle
- ActiveCell.FormulaR1C1 = "Player 2"
- Range("M1").Select
- Selection.Font.Underline = xlUnderlineStyleSingle
- ActiveCell.FormulaR1C1 = "Player 3"
- Range("Q1").Select
- Selection.Font.Underline = xlUnderlineStyleSingle
- ActiveCell.FormulaR1C1 = "Player 4"
- Range("U1").Select
- Selection.Font.Underline = xlUnderlineStyleSingle
- ActiveCell.FormulaR1C1 = "Player 5"
- Range("Y1").Select
- Selection.Font.Underline = xlUnderlineStyleSingle
- ActiveCell.FormulaR1C1 = "Player 6"
- Range("AC1").Select
- Selection.Font.Underline = xlUnderlineStyleSingle
- ActiveCell.FormulaR1C1 = "Used Decks"
- Range("AC2").Select
- ActiveCell.FormulaR1C1 = "10 cards"
- Range("AC3").Select
- Selection.Font.Underline = xlUnderlineStyleSingle
- ActiveCell.FormulaR1C1 = "Aces"
- Range("AC4").Select
- Selection.Font.Underline = xlUnderlineStyleSingle
- ActiveCell.FormulaR1C1 = "Low cards"
- Range("AC5").Select
- ActiveCell.FormulaR1C1 = "Running count"
- Range("AC6").Select
- Selection.Font.Underline = xlUnderlineStyleSingle
- ActiveCell.FormulaR1C1 = "How many decks"
- Range("AC7").Select
- Selection.Font.Underline = xlUnderlineStyleSingle
- ActiveCell.FormulaR1C1 = "True Count"
- Range("AC8").Select
- Columns("AC:AC").EntireColumn.AutoFit
- Range("E1:AA1").ColumnWidth = 6.8
- Range("C1").Select
- ActiveCell.FormulaR1C1 = "99"
- Range("C2").Select
- Columns("C:C").EntireColumn.AutoFit
- Range("C1").Select
- ActiveCell.FormulaR1C1 = ""
- Range("F1").Select
- ActiveCell.FormulaR1C1 = "99"
- Range("F2").Select
- Columns("F:F").EntireColumn.AutoFit
- Range("F1").Select
- ActiveCell.FormulaR1C1 = ""
- Range("H1").Select
- ActiveCell.FormulaR1C1 = "99"
- Range("H2").Select
- Columns("H:H").EntireColumn.AutoFit
- Range("J1").Select
- ActiveCell.FormulaR1C1 = "99"
- Range("J2").Select
- Columns("J:J").EntireColumn.AutoFit
- Range("L1").Select
- ActiveCell.FormulaR1C1 = "99"
- Range("L2").Select
- Columns("L:L").EntireColumn.AutoFit
- Range("N1").Select
- ActiveCell.FormulaR1C1 = "99"
- Range("N2").Select
- Columns("N:N").EntireColumn.AutoFit
- Range("P1").Select
- ActiveCell.FormulaR1C1 = "99"
- Range("P2").Select
- Columns("P:P").EntireColumn.AutoFit
- Range("R1").Select
- ActiveCell.FormulaR1C1 = "99"
- Range("R2").Select
- Columns("R:R").EntireColumn.AutoFit
- Range("T1").Select
- ActiveCell.FormulaR1C1 = "99"
- Range("T2").Select
- Columns("T:T").EntireColumn.AutoFit
- Range("V1").Select
- ActiveCell.FormulaR1C1 = "99"
- Range("V2").Select
- Columns("V:V").EntireColumn.AutoFit
- Range("X1").Select
- ActiveCell.FormulaR1C1 = "99"
- Range("X2").Select
- Columns("X:X").EntireColumn.AutoFit
- Range("Z1").Select
- ActiveCell.FormulaR1C1 = "99"
- Range("Z2").Select
- Columns("Z:Z").EntireColumn.AutoFit
- Range("AB1").Select
- ActiveCell.FormulaR1C1 = "99"
- Range("AB2").Select
- Columns("AB:AB").EntireColumn.AutoFit
- Columns("E:E").EntireColumn.AutoFit
- Columns("I:I").EntireColumn.AutoFit
- Columns("M:M").EntireColumn.AutoFit
- Columns("Q:Q").EntireColumn.AutoFit
- Columns("U:U").ColumnWidth = 8
- Columns("U:U").EntireColumn.AutoFit
- Columns("Y:Y").EntireColumn.AutoFit
- Range("AD1").Select
- ActiveCell.FormulaR1C1 = "1234.3"
- Range("AD2").Select
- Columns("AD:AD").EntireColumn.AutoFit
- Range("AD1").Select
- ActiveCell.FormulaR1C1 = ""
- Range("AB1").Select
- ActiveCell.FormulaR1C1 = ""
- Range("Z1").Select
- ActiveCell.FormulaR1C1 = ""
- Range("X1").Select
- ActiveCell.FormulaR1C1 = ""
- Range("V1").Select
- ActiveCell.FormulaR1C1 = ""
- Range("T1").Select
- ActiveCell.FormulaR1C1 = ""
- Range("R1").Select
- ActiveCell.FormulaR1C1 = ""
- Range("P1").Select
- ActiveCell.FormulaR1C1 = ""
- Range("N1").Select
- ActiveCell.FormulaR1C1 = ""
- Range("L1").Select
- ActiveCell.FormulaR1C1 = ""
- Range("J1").Select
- ActiveCell.FormulaR1C1 = ""
- Range("H1").Select
- ActiveCell.FormulaR1C1 = ""
- Range("D7").Select
- Range("A5:A20").Select
- Selection.RowHeight = 17.3
- Range("S11").Select
- Cells.Select
- With Selection.Interior
- .Pattern = xlSolid
- .PatternColorIndex = xlAutomatic
- .Color = 16644813
- .TintAndShade = 0
- .PatternTintAndShade = 0
- End With
- Range("E2").Select
- ActiveCell.FormulaR1C1 = "1000"
- Range("I2").Select
- ActiveCell.FormulaR1C1 = "1000"
- Range("E3").Select
- ActiveCell.FormulaR1C1 = "10"
- Range("I3").Select
- ActiveCell.FormulaR1C1 = "10"
- Range("D2").Select
- Selection.Font.Underline = xlUnderlineStyleSingle
- ActiveCell.FormulaR1C1 = "Bankroll"
- Range("D3").Select
- Selection.Font.Underline = xlUnderlineStyleSingle
- ActiveCell.FormulaR1C1 = "Bet"
- Range("D4").Select
- ActiveSheet.Buttons.Add(6.6, 12, 37.2, 33).Select
- Selection.OnAction = "Bet"
- Selection.Characters.Text = "Bet"
- With Selection.Characters(Start:=1, Length:=3).Font
- .Name = "Calibri"
- .FontStyle = "Regular"
- .Size = 11
- .Strikethrough = False
- .Superscript = False
- .Subscript = False
- .OutlineFont = False
- .Shadow = False
- .Underline = xlUnderlineStyleNone
- .ColorIndex = 1
- End With
- Range("D6").Select
- ActiveSheet.Buttons.Add(9, 60, 32.4, 29.4).Select
- Selection.OnAction = "hit"
- Selection.Characters.Text = "hit"
- With Selection.Characters(Start:=1, Length:=3).Font
- .Name = "Calibri"
- .FontStyle = "Regular"
- .Size = 11
- .Strikethrough = False
- .Superscript = False
- .Subscript = False
- .OutlineFont = False
- .Shadow = False
- .Underline = xlUnderlineStyleNone
- .ColorIndex = 1
- End With
- Range("D8").Select
- ActiveSheet.Buttons.Add(7.2, 105, 32.4, 29.4).Select
- Selection.OnAction = "split_button"
- Selection.Characters.Text = "Split"
- With Selection.Characters(Start:=1, Length:=5).Font
- .Name = "Calibri"
- .FontStyle = "Regular"
- .Size = 11
- .Strikethrough = False
- .Superscript = False
- .Subscript = False
- .OutlineFont = False
- .Shadow = False
- .Underline = xlUnderlineStyleNone
- .ColorIndex = 1
- End With
- ActiveSheet.Buttons.Add(1.8, 144.6, 39, 25.8).Select
- Selection.OnAction = "double_down"
- Selection.Characters.Text = "Double"
- With Selection.Characters(Start:=1, Length:=6).Font
- .Name = "Calibri"
- .FontStyle = "Regular"
- .Size = 11
- .Strikethrough = False
- .Superscript = False
- .Subscript = False
- .OutlineFont = False
- .Shadow = False
- .Underline = xlUnderlineStyleNone
- .ColorIndex = 1
- End With
- ActiveSheet.Buttons.Add(1.8, 180, 35, 25.8).Select
- Selection.OnAction = "surrender"
- Selection.Characters.Text = "sur"
- With Selection.Characters(Start:=1, Length:=3).Font
- .Name = "Calibri"
- .FontStyle = "Regular"
- .Size = 11
- .Strikethrough = False
- .Superscript = False
- .Subscript = False
- .OutlineFont = False
- .Shadow = False
- .Underline = xlUnderlineStyleNone
- .ColorIndex = 1
- End With
- 'Range("D13").Select
- ActiveSheet.Buttons.Add(1, 210.6, 45, 30).Select
- Selection.OnAction = "Stand"
- Selection.Characters.Text = "Stand"
- With Selection.Characters(Start:=1, Length:=5).Font
- .Name = "Calibri"
- .FontStyle = "Regular"
- .Size = 11
- .Strikethrough = False
- .Superscript = False
- .Subscript = False
- .OutlineFont = False
- .Shadow = False
- .Underline = xlUnderlineStyleNone
- .ColorIndex = 1
- End With
- ActiveSheet.Buttons.Add(613.8, 10.8, 38.4, 24.6).Select
- Selection.OnAction = "clean"
- Selection.Characters.Text = "clean"
- With Selection.Characters(Start:=1, Length:=5).Font
- .Name = "Calibri"
- .FontStyle = "Regular"
- .Size = 12
- .Strikethrough = False
- .Superscript = False
- .Subscript = False
- .OutlineFont = False
- .Shadow = False
- .Underline = xlUnderlineStyleNone
- .ColorIndex = 1
- End With
- ActiveSheet.Buttons.Add(732.6, 10.8, 45, 24.6).Select
- Selection.OnAction = "shuffle_Arr"
- Selection.Characters.Text = "shuffle"
- With Selection.Characters(Start:=1, Length:=7).Font
- .Name = "Calibri"
- .FontStyle = "Regular"
- .Size = 12
- .Strikethrough = False
- .Superscript = False
- .Subscript = False
- .OutlineFont = False
- .Shadow = False
- .Underline = xlUnderlineStyleNone
- .ColorIndex = 1
- End With
- Range("C1").Select
- Selection.Borders(xlDiagonalDown).LineStyle = xlNone
- Selection.Borders(xlDiagonalUp).LineStyle = xlNone
- With Selection.Borders(xlEdgeLeft)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeTop)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeBottom)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeRight)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlInsideVertical)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlInsideHorizontal)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- Selection.Borders(xlDiagonalDown).LineStyle = xlNone
- Selection.Borders(xlDiagonalUp).LineStyle = xlNone
- With Selection.Borders(xlEdgeLeft)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeTop)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeBottom)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeRight)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlInsideVertical)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlInsideHorizontal)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- Range("C2").Select
- Selection.Borders(xlDiagonalDown).LineStyle = xlNone
- Selection.Borders(xlDiagonalUp).LineStyle = xlNone
- With Selection.Borders(xlEdgeLeft)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeTop)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeBottom)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeRight)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlInsideVertical)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlInsideHorizontal)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- Range("C3").Select
- Selection.Borders(xlDiagonalDown).LineStyle = xlNone
- Selection.Borders(xlDiagonalUp).LineStyle = xlNone
- With Selection.Borders(xlEdgeLeft)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeTop)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeBottom)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeRight)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlInsideVertical)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlInsideHorizontal)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- Range("AC1:AD7").Select
- Selection.Borders(xlDiagonalDown).LineStyle = xlNone
- Selection.Borders(xlDiagonalUp).LineStyle = xlNone
- With Selection.Borders(xlEdgeLeft)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeTop)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeBottom)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeRight)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlInsideVertical)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlInsideHorizontal)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- Selection.Borders(xlDiagonalDown).LineStyle = xlNone
- Selection.Borders(xlDiagonalUp).LineStyle = xlNone
- With Selection.Borders(xlEdgeLeft)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeTop)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeBottom)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlEdgeRight)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlInsideVertical)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- With Selection.Borders(xlInsideHorizontal)
- .LineStyle = xlContinuous
- .ColorIndex = 0
- .TintAndShade = 0
- .Weight = xlThin
- End With
- ActiveSheet.Buttons.Add(6.6, 265, 31.8, 20).Select
- Selection.OnAction = "BackUp"
- Selection.Characters.Text = "back"
- With Selection.Characters(Start:=1, Length:=4).Font
- .Name = "Calibri"
- .FontStyle = "Regular"
- .Size = 12
- .Strikethrough = False
- .Superscript = False
- .Subscript = False
- .OutlineFont = False
- .Shadow = False
- .Underline = xlUnderlineStyleNone
- .ColorIndex = 1
- End With
- Range("D19").Select
- ActiveSheet.Buttons.Add(1, 291, 45, 20).Select
- Selection.OnAction = "Forward"
- Selection.Characters.Text = "forward"
- With Selection.Characters(Start:=1, Length:=7).Font
- .Name = "Calibri"
- .FontStyle = "Regular"
- .Size = 12
- .Strikethrough = False
- .Superscript = False
- .Subscript = False
- .OutlineFont = False
- .Shadow = False
- .Underline = xlUnderlineStyleNone
- .ColorIndex = 1
- End With
- 'ActiveSheet.Shapes("Button 13").ScaleWidth 1.1804199475, msoFalse, _
- msoScaleFromTopLeft
- 'Range("B20").Select
- 'ActiveSheet.Shapes.Range(Array("Button 12")).Select
- Range("E15").Select
- With ActiveWindow
- .SplitColumn = 1
- .SplitRow = 0
- End With
- Range("D1").Select
- ActiveCell.FormulaR1C1 = "=RC[26]"
- With Selection.Interior
- .Pattern = xlSolid
- .PatternColorIndex = xlAutomatic
- .Color = 65535
- .TintAndShade = 0
- .PatternTintAndShade = 0
- End With
- Selection.NumberFormat = "0.00"
- Range("B1").Select
- ActiveSheet.Buttons.Add(54, 2.4, 49.8, 12.6).Select
- Selection.OnAction = "H17YN"
- Selection.Characters.Text = "H17"
- Range("B2").Select
- ActiveSheet.Buttons.Add(54, 18, 49.8, 12.6).Select
- Selection.OnAction = "peekYN"
- Selection.Characters.Text = "PEEK"
- Range("B3").Select
- ActiveSheet.Buttons.Add(54, 34, 49.8, 12.6).Select
- Selection.OnAction = "insYN"
- Selection.Characters.Text = "INS"
- ActiveWindow.FreezePanes = True
- Application.CutCopyMode = False
- Sheets("play").Range("ad6").Value = 6
- Sheets("play").Range("ad1").Formula = "=((AD6*52)-COUNTA(AG:AG))/52"
- Sheets("play").Range("ad5").Formula = "=AD4-AD3-AD2"
- Sheets("play").Range("ad7").Formula = "=$AD$5/($AD$6-$AD$1)"
- Range("a1").Select
- shuffle_Arr
- instructions
- End Sub
- Sub instructions()
- '
- ' instructions Macro
- '
- '
- Sheets.Add after:=ActiveSheet
- ActiveSheet.Select
- ActiveSheet.Name = "instructions"
- Sheets("instructions").Select
- Range("C1").Select
- Range("c1").Select
- Sheets("instructions").Select
- ActiveCell.FormulaR1C1 = "First you need to download some cards:"
- Range("g1").Select
- ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
- "https://www.dropbox.com/scl/fo/2kfvqjum0tykkqxat6mfa/h?dl=0&rlkey=xdwe9qmx3igsaz1d2s5vs2zx1" _
- , TextToDisplay:="cards"
- Sheets("instructions").Select
- Application.CutCopyMode = False
- Range("c2").Select
- ActiveCell.FormulaR1C1 = "Open the cards folder"
- Range("c3").Select
- ActiveCell.FormulaR1C1 = "right click on url and copy address"
- Range("c4").Select
- ActiveCell.FormulaR1C1 = _
- "paste card address in A20 on play sheet"
- Range("C6").Select
- Sheets("instructions").Select
- ActiveCell.FormulaR1C1 = _
- "if you want the dealer to hit on a soft 17, then put a capital Y in "
- Sheets("instructions").Select
- ActiveCell.FormulaR1C1 = _
- "if you want the dealer to hit on a soft 17, then put a capital Y in C1"
- Range("C7").Select
- Sheets("instructions").Select
- ActiveCell.FormulaR1C1 = _
- "if you want the dealer to ""Peek"" for a blackjack then put a capital Y in C2"
- Range("C8").Select
- Sheets("instructions").Select
- ActiveCell.FormulaR1C1 = "if you want insurance then put a capital Y in C3"
- Range("C9").Select
- Sheets("instructions").Select
- Range("C10").Select
- ActiveCell.FormulaR1C1 = "running count calculation is:"
- Range("C11").Select
- ActiveCell.FormulaR1C1 = "cards 2-6 you add 1"
- Range("C12").Select
- ActiveCell.FormulaR1C1 = "cards 10 - A, you subtract one"
- Range("C13").Select
- ActiveCell.FormulaR1C1 = _
- "so if you have a 10 and a deuce those cancel out each other"
- Range("C14").Select
- ActiveCell.FormulaR1C1 = "but if you have 2 aces that counts as -2"
- Range("C15").Select
- ActiveCell.FormulaR1C1 = "if 2,3,4,5,6 come then that would be +5"
- Range("C16").Select
- ActiveCell.FormulaR1C1 = _
- "and so on and so on,,, easy, the hard part is memorizing the chart:"
- Range("C17").Select
- ActiveCell.FormulaR1C1 = "here is the chart:"
- Range("C18").Select
- Sheets("instructions").Select
- Range("e17").Select
- ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
- "https://www.blackjackapprenticeship.com/wp-content/uploads/2019/07/BJA_S17.pdf" _
- , TextToDisplay:="chart"
- Range("C19").Select
- ActiveCell.FormulaR1C1 = _
- "if you do everything according to the chart, you should make money..."
- Sheets("instructions").Select
- Range("C20").Select
- ActiveCell.FormulaR1C1 = _
- "the true count is the running count divided by the number of decks left"
- Range("C21").Select
- ActiveCell.FormulaR1C1 = _
- "you usually want a true count of 3 or more to start raising bets"
- Range("M1").Select
- Sheets("instructions").Select
- ActiveCell.FormulaR1C1 = _
- "heres a great video of a guy that toured the country playing blackjack,,,"
- Range("M2").Select
- ActiveCell.FormulaR1C1 = _
- "you might want to watch it before you decide to do it yourself,,, lol…"
- Range("M3").Select
- ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
- "https://rumble.com/v1frh4h-card-counter-hits-casinos-on-american-road-trip-inside-the-edge-wonder.html" _
- , TextToDisplay:="card counter road trip"
- Range("M5").Select
- Sheets("instructions").Select
- ActiveCell.FormulaR1C1 = "hella, good site for card counting:"
- Range("M6").Select
- ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
- "https://www.youtube.com/channel/UCdnKUMfRVRHuGrciZAqaCwQ", TextToDisplay:= _
- "blackjack apprenticeship"
- Range("M11").Select
- ActiveCell.FormulaR1C1 = "here's my Etsy..."
- Range("M12").Select
- ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
- "https://www.etsy.com/shop/ExcelByActorkitten?ref=shop_sugg_market", _
- TextToDisplay:="ExcelByActorkitten"
- Range("M17").Select
- Range("C1:I21").Select
- With Selection.Interior
- .Pattern = xlSolid
- .PatternColorIndex = xlAutomatic
- .Color = 65535
- .TintAndShade = 0
- .PatternTintAndShade = 0
- End With
- Range("M1:S2").Select
- With Selection.Interior
- .Pattern = xlSolid
- .PatternColorIndex = xlAutomatic
- .Color = 65535
- .TintAndShade = 0
- .PatternTintAndShade = 0
- End With
- Range("M5:p5").Select
- With Selection.Interior
- .Pattern = xlSolid
- .PatternColorIndex = xlAutomatic
- .Color = 65535
- .TintAndShade = 0
- .PatternTintAndShade = 0
- End With
- Range("M11:p11").Select
- With Selection.Interior
- .Pattern = xlSolid
- .PatternColorIndex = xlAutomatic
- .Color = 65535
- .TintAndShade = 0
- .PatternTintAndShade = 0
- End With
- Range("a:a").Delete
- Range("a1").Select
- End Sub
- Sub autoYN()
- If Sheets("play").Range("H1").Value = "Y" Then Sheets("play").Range("H1").Value = "N": Exit Sub
- If Sheets("play").Range("H1").Value <> "Y" Then Sheets("play").Range("H1").Value = "Y"
- End Sub
- Sub H17YN()
- If Sheets("play").Range("C1").Value = "Y" Then Sheets("play").Range("C1").Value = "N": Exit Sub
- If Sheets("play").Range("C1").Value <> "Y" Then Sheets("play").Range("C1").Value = "Y"
- End Sub
- Sub peekYN()
- If Sheets("play").Range("C2").Value = "Y" Then Sheets("play").Range("C2").Value = "N": Exit Sub
- If Sheets("play").Range("C2").Value <> "Y" Then Sheets("play").Range("C2").Value = "Y"
- End Sub
- Sub insYN()
- If Sheets("play").Range("C3").Value = "Y" Then Sheets("play").Range("C3").Value = "N": Exit Sub
- If Sheets("play").Range("C3").Value <> "Y" Then Sheets("play").Range("C3").Value = "Y"
- End Sub
- Sub Auto()
- 'auto1
- End Sub
- Sub colLoop(ColLet As String, RowNum As Long, standCount As Long, cardcount As Long, card As String)
- 'colloop1
- aces = 0
- Application.ScreenUpdating = False
- Application.EnableEvents = False
- cardcount = 0
- card = 0
- RowNum = 5
- 'If colLet = "B" Then Stop
- Do
- card = Sheets("play").Range(ColLet & RowNum).Value
- If Sheets("play").Range(ColLet & RowNum).Value = "A" Then aceCount aces
- If Sheets("play").Range(ColLet & RowNum).Value = "A" Then card = 11
- If Sheets("play").Range(ColLet & RowNum).Value = "K" Then card = 10
- If Sheets("play").Range(ColLet & RowNum).Value = "Q" Then card = 10
- If Sheets("play").Range(ColLet & RowNum).Value = "J" Then card = 10
- cardcount = cardcount + card
- If cardcount > 21 And aces > 0 Then cardcount = cardcount - 10: aces = aces - 1
- If cardcount > 21 And aces > 0 Then cardcount = cardcount - 10: aces = aces - 1
- If standCount = 17 And aces > 0 And Sheets("play").Range("c1").Value = "Y" Then standCount = 18
- If cardcount >= 17 And aces = 0 And Sheets("play").Range("c1").Value = "Y" Then Exit Do
- If cardcount >= standCount Then Exit Do
- If cardcount < standCount And RowNum >= 6 Then hit
- RowNum = RowNum + 1
- DoEvents
- Loop
- Application.ScreenUpdating = True
- Application.EnableEvents = True
- End Sub
- Sub automatic()
- End Sub
- Sub aceCount(aces As Long)
- 'acecount1
- aces = aces + 1
- End Sub
- Sub player1()
- Sheets("play").Range("E1").Interior.Color = vbGreen
- If Sheets("play").Range("h1").Value = "Y" Then Call Auto
- 'And Sheets("play").Cells(Rows.Count, "ag").End(xlUp).Row > 51
- End Sub
- Sub player2()
- Sheets("play").Range("I1").Interior.Color = vbGreen
- End Sub
- Sub player3()
- Sheets("play").Range("M1").Interior.Color = vbGreen
- End Sub
- Sub player4()
- Sheets("play").Range("Q1").Interior.Color = vbGreen
- End Sub
- Sub player5()
- Sheets("play").Range("U1").Interior.Color = vbGreen
- End Sub
- Sub player6()
- Sheets("play").Range("Y1").Interior.Color = vbGreen
- End Sub
- Sub player1_split()
- Sheets("play").Range("G1").Interior.Color = vbGreen
- End Sub
- Sub player2_split()
- Sheets("play").Range("K1").Interior.Color = vbGreen
- End Sub
- Sub player3_split()
- Sheets("play").Range("O1").Interior.Color = vbGreen
- End Sub
- Sub player4_split()
- Sheets("play").Range("S1").Interior.Color = vbGreen
- End Sub
- Sub player5_split()
- Sheets("play").Range("W1").Interior.Color = vbGreen
- End Sub
- Sub player6_split()
- Sheets("play").Range("AA1").Interior.Color = vbGreen
- End Sub
- Sub copy_paste()
- 'copypaste1
- Application.ScreenUpdating = False
- Sheets("play").Range("al:bo").Insert
- Sheets("play").Range("b1:ad20").Copy
- Sheets("play").Range("aL1").PasteSpecial Paste:=xlPasteValues
- Sheets("play").Range("al1:bo20").Font.ColorIndex = vbBlack
- Sheets("play").Range("al1:bo20").NumberFormat = "@"
- Sheets("play").Range("al1:bo1").ColumnWidth = 4.6
- Sheets("play").Range("al1").Value = Sheets("play").Range("a1").Value
- Sheets("play").Range("a1").Value = Sheets("play").Range("a1").Value + 1
- Application.ScreenUpdating = True
- End Sub
- Sub BackUp()
- 'backup1
- Dim a As Long, b As Long
- If Selection.Column < 38 Then
- ActiveWindow.ScrollRow = 1
- ActiveWindow.ScrollColumn = 38
- Cells(1, 38).Select
- Exit Sub
- End If
- If ActiveWindow.ScrollColumn >= 38 Then
- ActiveWindow.ScrollRow = 1
- ActiveWindow.ScrollColumn = ActiveWindow.ScrollColumn + 30
- End If
- End Sub
- Sub Forward()
- 'forward1
- Dim a As Long, b As Long
- If ActiveWindow.ScrollColumn >= 38 Then
- ActiveWindow.ScrollRow = 1
- ActiveWindow.ScrollColumn = ActiveWindow.ScrollColumn - 30
- End If
- If ActiveWindow.ScrollColumn < 38 Then ActiveWindow.ScrollColumn = 1
- End Sub
- Sub clean()
- 'clean1
- Dim p As String, q As Long, x As Long, longrow As Long
- 'p = column letter
- 'q = column number
- x = longrow
- Application.ScreenUpdating = False
- For q = 5 To 27 Step 2
- p = NumbersToColumns(q)
- Sheets("play").Range(p & 1).Interior.Color = RGB(205, 250, 253)
- Next q
- Sheets("play").Range("b1").Interior.Color = RGB(205, 250, 253)
- For q = 7 To 27 Step 4
- p = NumbersToColumns(q)
- Sheets("play").Range(p & 3).Value = ""
- Next q
- Dim rng As Range, i As Long, j As Long
- Dim Name As String, k As String
- Dim pic As Picture
- 'For i = 2 To 27
- 'longrow = Sheets("play").Cells(99, i).End(xlUp).Row
- '
- ' For j = 5 To longrow
- '
- ' p = NumbersToColumns(i)
- ' k = NumbersToColumns(i + 36)
- ' For Each pic In ActiveSheet.Pictures
- '
- ' Set rng = ActiveSheet.Range(p & j)
- ' If rng.Value = "" Then GoTo label
- ' If rng.Value = "S" Then GoTo label
- ' If rng.Value = "D" Then GoTo label
- ' If rng.Value = "H" Then GoTo label
- ' If rng.Value = "C" Then GoTo label
- ' If pic.Left < 1000 Then
- ' If Int(pic.Top) = Int(rng.Top) And Int(pic.Left) = Int(rng.Left) Then
- ' Name = pic.Name
- ' End If
- '
- '
- ' End If
- ' Next pic
- ' Set pic = ActiveSheet.Pictures(Name)
- ' Set rng = ActiveSheet.Range(k & j)
- '
- ' pic.Top = rng.Top
- ' pic.Left = rng.Left
- ' 'MsgBox Name & " " & rng.Top & " " & rng.Left
- ' Next j
- 'label:
- 'Next i
- For Each pic In ActiveSheet.Pictures
- pic.Delete
- DoEvents
- Next pic
- Sheets("play").Range("E4:AB99").ClearContents
- Sheets("play").Range("E4:AB99").Font.Color = vbBlack
- Sheets("play").Range("B5:C99").ClearContents
- Sheets("play").Range("B5:B99").Font.Color = vbBlack
- Sheets("play").Range("C4").ClearContents
- End Sub
- Sub reset()
- 'reset1
- Sheets("play").Range("e2").Value = 1000
- Sheets("play").Range("i2").Value = 1000
- Sheets("play").Range("m2").Value = 1000
- Sheets("play").Range("q2").Value = 1000
- Sheets("play").Range("u2").Value = 1000
- Sheets("play").Range("y2").Value = 1000
- Sheets("play").Range("e3").Value = 10
- Sheets("play").Range("i3").Value = 10
- Sheets("play").Range("m3").Value = 10
- Sheets("play").Range("q3").Value = 10
- Sheets("play").Range("u3").Value = 10
- Sheets("play").Range("y3").Value = 10
- Sheets("play").Range("ac8").Value = 0
- End Sub
- Sub Bet()
- 'bet1
- Dim aa As Long, bb As String, lg1 As Long
- Dim x As String, y As Long, z As Long, multiple As Double
- multiple = Sheets("play").Range("p1").Value
- 'Sheets("play").Range("E2").Value = 1000
- 'Sheets("play").Range("I2").Value = 1000
- 'Sheets("play").Range("E3").Value = 10
- 'Sheets("play").Range("I3").Value = 10
- 'sheets("play").Range("AD2").Value = ""
- 'sheets("play").Range("AD3").Value = ""
- 'sheets("play").Range("AD4").Value = ""
- '
- 'sheets("play").Range("G3").Value = ""
- 'sheets("play").Range("K3").Value = ""
- 'sheets("play").Range("O3").Value = ""
- 'sheets("play").Range("S3").Value = ""
- 'sheets("play").Range("W3").Value = ""
- 'sheets("play").Range("AA3").Value = ""
- Range("b1").Select
- Application.ScreenUpdating = False
- Range("e1").Select
- Do
- If ActiveCell.Interior.Color = vbGreen Then Exit Sub
- ActiveCell.Offset(0, 1).Select
- DoEvents
- Loop Until Selection.Address = Sheets("play").Range("ab1").Address
- copy_paste 'If Sheets("play").Range("h1").Value <> "Y" Then copy_paste
- If Sheets("play").Cells(Rows.Count, "ag").End(xlUp).Row <= 50 And Sheets("play").Cells(1, "H").Value = "Y" Then shuffle_Arr
- If Sheets("play").Cells(Rows.Count, "ag").End(xlUp).Row <= 50 And Sheets("play").Cells(1, "H").Value <> "Y" Then
- answer = MsgBox("shuffle", vbQuestion + vbYesNo) '+ vbDefaultButton2
- If answer = 6 Then shuffle_Arr
- If answer = 7 Then Exit Sub
- End If
- clean
- If Sheets("play").Cells(Rows.Count, "ag").End(xlUp).Row <= 50 Then Exit Sub
- If Sheets("play").Range("h1").Value = "Y" Then
- For y = 5 To 25 Step 4
- x = NumbersToColumns(y)
- If Sheets("play").Range(x & 3).Value = "" And Sheets("play").Range(x & 2).Value <> "" Then
- Sheets("play").Range(x & 3).Value = Sheets("play").Range("n1").Value
- If Sheets("play").Range("ad7").Value > 3 Then
- 'Sheets("play").Range(x & 3).Value = Sheets("play").Range(x & 3).Value * Sheets("play").Range("p1").Value
- End If
- End If
- Next y
- End If
- If Sheets("play").Range("h1").Value <> "Y" Then
- For y = 5 To 25 Step 4
- x = NumbersToColumns(y)
- If Sheets("play").Range(x & 3).Value = "" And Sheets("play").Range(x & 2).Value <> "" Then
- MsgBox (Sheets("play").Range(x & 1).Value & " must bet"): Exit Sub
- End If
- Next y
- End If
- For y = 5 To 25 Step 4
- x = NumbersToColumns(y) ' player columny = 5 ' player column number
- z = 20 ' A column cards
- aa = 6 ' score column number
- bb = "I"
- If Sheets("play").Range(x & 5).Value <> "" Then GoTo LABEL
- If Sheets("play").Range("h1").Value = "Y" Then Sheets("play").Range(x & 3).Value = Sheets("play").Range("n1").Value
- If Sheets("play").Range("h1").Value = "Y" Then
- If Sheets("play").Range(x & 3).Value <> "" And Sheets("play").Range("ad7").Value > 3 Then
- Sheets("play").Range(x & 3).Value = Sheets("play").Range("n1").Value * multiple
- End If
- If Sheets("play").Range(x & 3).Value <> "" And Sheets("play").Range("ad7").Value > 6 Then
- Sheets("play").Range(x & 3).Value = Sheets("play").Range("n1").Value * multiple * 3
- End If
- End If
- Sheets("play").Range(x & 2).Value = Sheets("play").Range(x & 2).Value - Sheets("play").Range(x & 3).Value
- bCard = Sheets("play").Range("AG1").Value
- cRow = 5
- cCol = y
- InsertImage bCard, cRow, cCol
- bCard = Sheets("play").Range("AG2").Value
- cRow = 6
- cCol = y
- InsertImage bCard, cRow, cCol
- Sheets("play").Range("Aj1:ak2").Copy Sheets("play").Range(x & 5)
- Sheets("play").Range("Ag1:ak2").Delete
- bet_count x
- Application.ScreenUpdating = True
- If Sheets("play").Cells(2, "aa").Value <> "" Then Stop
- If Sheets("play").Cells(2, y).End(xlToRight).Column = 29 Then dealer: Exit Sub
- LABEL:
- DoEvents
- Next y
- End Sub
- Sub bet_count(x As String) 'bet runningcount
- 'betcount1
- If Sheets("play").Range(x & 5).Value = "A" Then Sheets("play").Range("AD3").Value = Sheets("play").Range("AD3").Value + 1
- If Sheets("play").Range(x & 5).Value = "K" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range(x & 5).Value = "Q" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range(x & 5).Value = "J" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range(x & 5).Value = "10" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range(x & 5).Value = "2" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(x & 5).Value = "3" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(x & 5).Value = "4" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(x & 5).Value = "5" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(x & 5).Value = "6" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(x & 6).Value = "A" Then Sheets("play").Range("AD3").Value = Sheets("play").Range("AD3").Value + 1
- If Sheets("play").Range(x & 6).Value = "K" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range(x & 6).Value = "Q" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range(x & 6).Value = "J" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range(x & 6).Value = "10" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range(x & 6).Value = "2" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(x & 6).Value = "3" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(x & 6).Value = "4" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(x & 6).Value = "5" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(x & 6).Value = "6" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- End Sub
- Sub shuffle_Arr()
- 'shuffle1
- Dim str As String, a As Long, y As Long, x As Long, arr3() As String
- Dim z As Long, pic As Picture, arr() As String
- Application.ScreenUpdating = False
- 'Debug.Print Application.ScreenUpdating
- Sheets("play").Range("ag:ak").ClearContents
- Sheets("play").Range("AAA:xfd").Delete
- 'Sheets("play").Range("ac8").Value = Sheets("play").Range("ac8").Value + 1
- For y = 0 To Sheets("play").Range("ad6").Value - 1
- str = "10_of_C,2_of_C,3_of_C,4_of_C,5_of_C,6_of_C,7_of_C,8_of_C,9_of_C,A_of_C,J_of_C,K_of_C,Q_of_C,10_of_D,2_of_D,3_of_D,4_of_D,5_of_D,6_of_D,7_of_D,8_of_D,9_of_D,A_of_D,J_of_D,K_of_D,Q_of_D,10_of_H,2_of_H,3_of_H,4_of_H,5_of_H,6_of_H,7_of_H,8_of_H,9_of_H,A_of_H,J_of_H,K_of_H,Q_of_H,10_of_S,2_of_S,3_of_S,4_of_S,5_of_S,6_of_S,7_of_S,8_of_S,9_of_S,A_of_S,J_of_S,K_of_S,Q_of_S"
- ReDim arr(1 To 52)
- arr = Split(str, ",")
- Dim arr2 As String
- x = (y * 52) + 1
- For a = UBound(arr) To LBound(arr) Step -1
- Dim k As Double
- k = Int(Rnd * a + 1)
- If a = 0 And k = 1 Then k = 0
- arr2 = arr(k)
- ReDim Preserve arr3(x)
- arr3(x) = arr2
- If k > 0 Then arr = DeleteElement(arr2, arr)
- x = x + 1
- DoEvents
- Next a
- Erase arr
- DoEvents
- Next y
- For z = y * 52 To 1 Step -1
- k = Int(Rnd * z + 1)
- If z = 0 And k = 1 Then k = 0
- arr2 = arr3(k)
- Sheets("play").Range("AG" & z).Value = arr2
- If k > 0 Then arr3 = DeleteElement(arr2, arr3)
- DoEvents
- Next z
- Erase arr3
- Sheets("play").Range("af1").Formula = "=rand()"
- Sheets("play").Range("ah1").Formula = "=TEXTBEFORE(AG1, """ & "_" & """)"
- Sheets("play").Range("ai1").Formula = "=TEXTAFTER(AG1, """ & "_" & """, -1)"
- a = Sheets("play").Cells(Rows.Count, "AG").End(xlUp).Row
- Sheets("play").Range("AH1:AI" & a).FillDown
- Sheets("play").Range("Af1:Af" & a).FillDown
- Columns("AF:AG").Select
- ActiveWorkbook.Worksheets("play").Sort.SortFields.Clear
- ActiveWorkbook.Worksheets("play").Sort.SortFields.Add2 Key:=Range("AF1:AF" & a _
- ), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
- With ActiveWorkbook.Worksheets("play").Sort
- .SetRange Range("AF1:AG" & a)
- .Header = xlGuess
- .MatchCase = False
- .Orientation = xlTopToBottom
- .SortMethod = xlPinYin
- .Apply
- End With
- Sheets("play").Range("ah1:ai" & a).Copy
- Sheets("play").Range("aj1").PasteSpecial (xlPasteValues)
- Sheets("play").Range("AG1:AK" & a).Font.Color = RGB(205, 250, 253)
- Sheets("play").Range("AD2:AD4").ClearContents
- Columns("AJ:AJ").Select
- Selection.TextToColumns Destination:=Range("AJ1"), DataType:=xlDelimited, _
- TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
- Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
- :=Array(1, 1), TrailingMinusNumbers:=True
- 'For Each pic In ActiveSheet.Pictures
- ' pic.Delete
- ' DoEvents
- 'Next pic
- Sheets("play").Range("a1").Value = 0
- Application.ScreenUpdating = True
- Sheets("play").Range("b1").Select
- 'reset
- End Sub
- Public Function NumbersToColumns(myCol As Long)
- 'NumbersToColumns1
- Dim iA As Long, fA As Long
- If myCol >= 1 And myCol <= 16384 Then
- iA = Int((myCol - 1) / 26)
- fA = Int(IIf(iA - 1 > 0, (iA - 1) / 26, 0))
- NumbersToColumns = IIf(fA > 0, Chr(fA + 64), "") & _
- IIf(iA - fA * 26 > 0, Chr(iA - fA * 26 + 64), "") & _
- Chr(myCol - iA * 26 + 64)
- Else
- NumbersToColumns = False
- End If
- End Function
- Sub AddRowsToArr(arr, Optional ByVal nRows As Long = 1, Optional overwrite As Boolean = True)
- 'directions: 'AddRowsToArr myArray3, 1 ---no parenthesis
- 'define arrays of needed row and column numbers
- Dim r, C
- r = Evaluate("row(1:" & CStr(nRows + UBound(arr) - LBound(arr) + 1) & ")")
- C = Application.Transpose(Evaluate("row(1:" & CStr(UBound(arr, 1) - LBound(arr, 1) + 1) & ")"))
- '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- 'redimension array to new size
- '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- arr = Application.Index(arr, r, C)
- '*) optional overwriting added row elements with Empty ~~> see Note below!
- '...
- End Sub
- Function DeleteElement(x As String, ByRef List() As String) ' As String
- Dim i As Long, el As Long
- Dim result() As String
- ReDim result(UBound(List) - 1)
- For i = 0 To UBound(List)
- If x = List(i) Then
- el = i
- Exit For
- End If
- Next i
- For i = 0 To UBound(result)
- If i < el Then
- result(i) = List(i)
- Else
- result(i) = List(i + 1)
- End If
- Next i
- DeleteElement = result
- End Function
- Function sumSkip(target As Range, Scell As Long, Snumber As Long)
- 'sumskip1
- 'sumskip(range,starting row, rows to skip) ie.-range b1:b100, 5, 10 will add every 10th cell starting with the 5th row
- Dim Fnumber As Long, answer As Long, a As Long
- Fnumber = target.Rows.Count / Snumber
- For a = 1 To Fnumber
- answer = answer + Cells(Scell, target.Column).Value
- Scell = Scell + Snumber
- Next
- sumSkip = answer
- End Function
- Sub dealer()
- 'dealer1
- Dim result As Long, x As Long, a As Long, longrow As Long, in3 As String
- Dim y As String, AB As Long, b As Boolean, C As Boolean
- Dim cardcount As Long, card As String
- bCard = Sheets("play").Range("AG1").Value
- cRow = 5
- cCol = 2
- InsertImage bCard, cRow, cCol
- Set myImage = ActiveSheet.Shapes(ActiveSheet.Shapes.Count)
- If Sheets("play").Range("h1").Value <> "Y" Then myImage.Visible = msoFalse
- bCard = Sheets("play").Range("AG2").Value
- cRow = 6
- cCol = 2
- InsertImage bCard, cRow, cCol
- Sheets("play").Range("Aj1:ak2").Copy Sheets("play").Range("B5")
- Sheets("play").Range("Af1:ak2").Delete
- If Sheets("play").Range("B6").Value = "A" And Sheets("play").Range("C3").Value = "Y" _
- And Sheets("play").Range("h1").Value <> "Y" Then insurance
- If Sheets("play").Range("B6").Value = "A" And Sheets("play").Range("C3").Value = "Y" _
- And Sheets("play").Range("h1").Value = "Y" And Sheets("play").Range("ad7").Value > 3 Then insurance
- If Sheets("play").Range("B5").Value = 10 Or Sheets("play").Range("B5").Value = "J" Or Sheets("play").Range("B5").Value = "Q" Or Sheets("play").Range("B5").Value = "K" Then b = True
- If Sheets("play").Range("B6").Value = 10 Or Sheets("play").Range("B6").Value = "J" Or Sheets("play").Range("B6").Value = "Q" Or Sheets("play").Range("B6").Value = "K" Then C = True
- For a = 5 To 27
- y = NumbersToColumns(a)
- If Sheets("play").Range(y & 3).Value = "" Then GoTo label2
- If b = False And Sheets("play").Range(y & 7).Value = "Insurance" Then
- Sheets("play").Range(y & 3).Value = Sheets("play").Range(y & 3).Value * 2 / 3
- Sheets("play").Range(y & 7).Value = ""
- End If
- label2:
- Next a
- Application.ScreenUpdating = False
- If Sheets("play").Range("C2").Value = "Y" And b = True And Sheets("play").Range("B6").Value = "A" Then
- ' Peek shown ace
- For a = 5 To 27 Step 2
- x = 5
- cardcount = 0
- y = NumbersToColumns(a)
- If Sheets("play").Range(y & x).Value = "" Then GoTo LABEL
- If b = True And Sheets("play").Range(y & 7).Value = "Insurance" And Sheets("play").Range("C3").Value = "Y" Then
- Sheets("play").Range(y & 2).Value = Sheets("play").Range(y & 2).Value + Sheets("play").Range(y & 3).Value
- Sheets("play").Range(y & 3).Value = Sheets("play").Range(y & 3).Value * 2 / 3
- Sheets("play").Range(y & 7).Value = ""
- End If
- Do Until Sheets("play").Range(y & x).Value = ""
- longrow = Sheets("play").Cells(99, a).End(xlUp).Row
- card = Sheets("play").Range(y & x).Value
- If card = "C" Or card = "H" Or card = "D" Or card = "S" Or card = "BLACKJACK" Or card = "" Then GoTo LABEL
- If Sheets("play").Range(y & x).Value = "J" Then card = 10
- If Sheets("play").Range(y & x).Value = "Q" Then card = 10
- If Sheets("play").Range(y & x).Value = "K" Then card = 10
- If Sheets("play").Range(y & x).Value = "A" Then card = 11
- cardcount = cardcount + card
- If x = 6 And cardcount = 21 Then
- Sheets("play").Range(y & x + 5).Value = "BLACKJACK": Sheets("play").Range(NumbersToColumns(a) & 4).Offset(0, 1) = cardcount
- End If
- x = x + 1
- DoEvents
- Loop
- Sheets("play").Range(NumbersToColumns(a) & 4).Offset(0, 1) = cardcount
- LABEL:
- Next a
- stand2
- End If
- If Sheets("play").Range("C2").Value = "Y" And C = True And Sheets("play").Range("B5").Value = "A" Then
- ' peek hidden ace
- For a = 5 To 27 Step 2
- x = 5
- cardcount = 0
- y = NumbersToColumns(a)
- If Sheets("play").Range(y & x).Value = "" Then GoTo label3
- Do Until Sheets("play").Range(y & x).Value = ""
- longrow = Sheets("play").Cells(99, a).End(xlUp).Row
- card = Sheets("play").Range(y & x).Value
- If card = "C" Or card = "H" Or card = "D" Or card = "S" Or card = "BLACKJACK" Or card = "" Then GoTo label3
- If Sheets("play").Range(y & x).Value = "J" Then card = 10
- If Sheets("play").Range(y & x).Value = "Q" Then card = 10
- If Sheets("play").Range(y & x).Value = "K" Then card = 10
- If Sheets("play").Range(y & x).Value = "A" Then card = 11
- cardcount = cardcount + card
- If x = 6 And cardcount = 21 Then
- Sheets("play").Range(y & x + 5).Value = "BLACKJACK": Sheets("play").Range(NumbersToColumns(a) & 4).Offset(0, 1) = cardcount
- End If
- x = x + 1
- DoEvents
- Loop
- Sheets("play").Range(NumbersToColumns(a) & 4).Offset(0, 1) = cardcount
- label3:
- Next a
- stand2
- End If
- If Sheets("play").Cells(7, a).Value = "Insurance" Then
- For a = 5 To 27
- ' Insurace payout
- Sheets("play").Cells(3, a).Value = Sheets("play").Cells(3, a).Value * 2 / 3
- Sheets("play").Cells(7, a).Value = ""
- DoEvents
- Next a
- End If
- Application.ScreenUpdating = True
- If Sheets("play").Range("C4").Value = "" Then player1
- End Sub
- Sub split_button()
- 'split1
- Dim longrow As Long, int2 As Long, card As String, cardcount As Long, lg1 As Long
- Dim x As String, y As String, z As String, a As Long, b As Long, aa As Long, bb As Long
- Application.ScreenUpdating = False
- 'x = "E" ' player column
- 'y = "F" ' score column
- 'z = "G" ' split column
- 'a = 5 ' player column number
- 'b = 6 ' score column number
- Range("e1").Select
- Do
- If ActiveCell.Interior.Color = vbGreen Then Exit Do
- ActiveCell.Offset(0, 1).Select
- DoEvents
- Loop Until Selection.Address = Sheets("play").Range("ab1").Address
- If Selection.Address = Sheets("play").Range("ab1").Address Then Exit Sub
- If Sheets("play").Range("E1").Interior.Color = vbGreen Then x = "E" ' player column number
- If Sheets("play").Range("E1").Interior.Color = vbGreen Then y = "F" ' player column
- If Sheets("play").Range("E1").Interior.Color = vbGreen Then z = "G" ' split player column
- If Sheets("play").Range("E1").Interior.Color = vbGreen Then a = 5
- If Sheets("play").Range("E1").Interior.Color = vbGreen Then b = 6
- If Sheets("play").Range("I1").Interior.Color = vbGreen Then x = "I" ' player column number
- If Sheets("play").Range("I1").Interior.Color = vbGreen Then y = "J" ' player column
- If Sheets("play").Range("I1").Interior.Color = vbGreen Then z = "K" ' split player column
- If Sheets("play").Range("I1").Interior.Color = vbGreen Then a = 9
- If Sheets("play").Range("I1").Interior.Color = vbGreen Then b = 10
- If Sheets("play").Range("M1").Interior.Color = vbGreen Then x = "M" ' player column number
- If Sheets("play").Range("M1").Interior.Color = vbGreen Then y = "N" ' player column
- If Sheets("play").Range("M1").Interior.Color = vbGreen Then z = "O" ' split player column
- If Sheets("play").Range("M1").Interior.Color = vbGreen Then a = 13
- If Sheets("play").Range("M1").Interior.Color = vbGreen Then b = 15
- If Sheets("play").Range("Q1").Interior.Color = vbGreen Then x = "Q" ' player column number
- If Sheets("play").Range("Q1").Interior.Color = vbGreen Then y = "R" ' player column
- If Sheets("play").Range("Q1").Interior.Color = vbGreen Then z = "S" ' split player column
- If Sheets("play").Range("Q1").Interior.Color = vbGreen Then a = 17
- If Sheets("play").Range("Q1").Interior.Color = vbGreen Then b = 18
- If Sheets("play").Range("U1").Interior.Color = vbGreen Then x = "U" ' player column number
- If Sheets("play").Range("U1").Interior.Color = vbGreen Then y = "V" ' player column
- If Sheets("play").Range("U1").Interior.Color = vbGreen Then z = "W" ' split player column
- If Sheets("play").Range("U1").Interior.Color = vbGreen Then a = 21
- If Sheets("play").Range("U1").Interior.Color = vbGreen Then b = 22
- If Sheets("play").Range("Y1").Interior.Color = vbGreen Then x = "Y" ' player column number
- If Sheets("play").Range("Y1").Interior.Color = vbGreen Then y = "Z" ' player column
- If Sheets("play").Range("Y1").Interior.Color = vbGreen Then z = "AA" ' split player column
- If Sheets("play").Range("Y1").Interior.Color = vbGreen Then a = 25
- If Sheets("play").Range("Y1").Interior.Color = vbGreen Then b = 26
- If Sheets("play").Range(z & 5).Value <> "" Then MsgBox ("You have already split"): Exit Sub
- split_me x, y, z, a
- Application.ScreenUpdating = True
- End Sub
- Sub split_me(x As String, y As String, z As String, a As Long)
- ' splitme1
- 'x = "E" ' player column
- 'y = "F" ' score column
- 'z = "G" ' split column
- 'a = 5 ' player column number
- 'b = 6 ' score column number
- 'aa = 20 ' A column cards
- 'bb = 200 ' A column split cards
- If Sheets("play").Range(x & 5).Value <> Sheets("play").Range(x & 6).Value Then MsgBox ("You can only split pairs"): Exit Sub
- Dim longrow As Long
- longrow = Sheets("play").Cells(99, a).End(xlUp).Row
- If longrow > 6 Then MsgBox ("You can't split with more than 2 cards"): Exit Sub
- Sheets("play").Range(x & 6, y & 6).Copy Sheets("play").Range(z & 5)
- Dim shp As Picture
- Dim rng As Range
- Dim Name As String
- 'Set the range to the cell you want to check
- Set rng = ActiveSheet.Range(x & 6)
- For Each shp In ActiveSheet.Pictures
- 'Check if the shape is within the specified cell
- If Int(shp.Top) = Int(rng.Top) And Int(shp.Left) = Int(rng.Left) Then
- Name = shp.Name
- End If
- Next shp
- Set shp = ActiveSheet.Pictures(Name)
- Set rng = ActiveSheet.Range(z & 5)
- shp.Top = rng.Top
- shp.Left = rng.Left
- Sheets("play").Range(x & 6, y & 6).ClearContents
- bCard = Sheets("play").Range("AG1").Value
- cRow = 6
- cCol = a
- InsertImage bCard, cRow, cCol
- Sheets("play").Range("Aj1:ak1").Copy Sheets("play").Range(x & 6)
- Sheets("play").Range("Ag1:ak1").Delete
- bCard = Sheets("play").Range("AG1").Value
- cRow = 6
- cCol = a + 2
- InsertImage bCard, cRow, cCol
- Sheets("play").Range("Aj1:ak1").Copy Sheets("play").Range(z & 6)
- Sheets("play").Range("Ag1:ak1").Delete
- split_count x, z
- Sheets("play").Range(x & 3).Copy Sheets("play").Range(z & 3)
- Sheets("play").Range(x & 2).Value = Sheets("play").Range(x & 2).Value - Sheets("play").Range(z & 3).Value
- End Sub
- Sub split_count(x As String, z As String) 'split runningcount
- 'splitcount1
- If Sheets("play").Range(x & 6).Value = "A" Then Sheets("play").Range("AD3").Value = Sheets("play").Range("AD3").Value + 1
- If Sheets("play").Range(x & 6).Value = "K" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range(x & 6).Value = "Q" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range(x & 6).Value = "J" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range(x & 6).Value = "10" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range(x & 6).Value = "2" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(x & 6).Value = "3" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(x & 6).Value = "4" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(x & 6).Value = "5" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(x & 6).Value = "6" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(z & 6).Value = "A" Then Sheets("play").Range("AD3").Value = Sheets("play").Range("AD3").Value + 1
- If Sheets("play").Range(z & 6).Value = "K" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range(z & 6).Value = "Q" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range(z & 6).Value = "J" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range(z & 6).Value = "10" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range(z & 6).Value = "2" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(z & 6).Value = "3" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(z & 6).Value = "4" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(z & 6).Value = "5" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(z & 6).Value = "6" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- End Sub
- Sub double_down()
- 'double down1
- Dim z As String, bb As String
- Dim a As Long, x As String, y As Long, aa As Long, cc As Long, dd As Long, longrow As Long, int2 As Long, card As String, cardcount As Long
- Application.ScreenUpdating = False
- Range("e1").Select
- Do
- If ActiveCell.Interior.Color = vbGreen Then Exit Do
- ActiveCell.Offset(0, 1).Select
- DoEvents
- Loop Until Selection.Address = Sheets("play").Range("ab1").Address
- If Selection.Address = Sheets("play").Range("ab1").Address Then Exit Sub
- If Sheets("play").Range("E1").Interior.Color = vbGreen Then x = "E" ' player column number
- If Sheets("play").Range("E1").Interior.Color = vbGreen Then y = 5 ' player column
- If Sheets("play").Range("G1").Interior.Color = vbGreen Then x = "G" ' player column number
- If Sheets("play").Range("G1").Interior.Color = vbGreen Then y = 7 ' player column
- If Sheets("play").Range("I1").Interior.Color = vbGreen Then x = "I" ' player column number
- If Sheets("play").Range("I1").Interior.Color = vbGreen Then y = 9 ' player column
- If Sheets("play").Range("K1").Interior.Color = vbGreen Then x = "K" ' player column number
- If Sheets("play").Range("K1").Interior.Color = vbGreen Then y = 11 ' player column
- If Sheets("play").Range("M1").Interior.Color = vbGreen Then x = "M" ' player column number
- If Sheets("play").Range("M1").Interior.Color = vbGreen Then y = 13 ' player column
- If Sheets("play").Range("O1").Interior.Color = vbGreen Then x = "O" ' player column number
- If Sheets("play").Range("O1").Interior.Color = vbGreen Then y = 15 ' player column
- If Sheets("play").Range("Q1").Interior.Color = vbGreen Then x = "Q" ' player column number
- If Sheets("play").Range("Q1").Interior.Color = vbGreen Then y = 17 ' player column
- If Sheets("play").Range("S1").Interior.Color = vbGreen Then x = "S" ' player column number
- If Sheets("play").Range("S1").Interior.Color = vbGreen Then y = 19 ' player column
- If Sheets("play").Range("U1").Interior.Color = vbGreen Then x = "U" ' player column number
- If Sheets("play").Range("U1").Interior.Color = vbGreen Then y = 21 ' player column
- If Sheets("play").Range("W1").Interior.Color = vbGreen Then x = "W" ' player column number
- If Sheets("play").Range("W1").Interior.Color = vbGreen Then y = 23 ' player column
- If Sheets("play").Range("Y1").Interior.Color = vbGreen Then x = "Y" ' player column number
- If Sheets("play").Range("Y1").Interior.Color = vbGreen Then y = 25 ' player column
- If Sheets("play").Range("AA1").Interior.Color = vbGreen Then x = "AA" ' player column number
- If Sheets("play").Range("AA1").Interior.Color = vbGreen Then y = 27 ' player column
- longrow = Sheets("play").Cells(99, y).End(xlUp).Row
- If longrow >= 7 Then MsgBox ("you can't double down"): Exit Sub
- If Sheets("play").Range("E1").Interior.Color = vbGreen Then doubledown_me x, y, longrow, card, cardcount, int2
- If Sheets("play").Range("I1").Interior.Color = vbGreen Then doubledown_me x, y, longrow, card, cardcount, int2
- If Sheets("play").Range("M1").Interior.Color = vbGreen Then doubledown_me x, y, longrow, card, cardcount, int2
- If Sheets("play").Range("Q1").Interior.Color = vbGreen Then doubledown_me x, y, longrow, card, cardcount, int2
- If Sheets("play").Range("U1").Interior.Color = vbGreen Then doubledown_me x, y, longrow, card, cardcount, int2
- If Sheets("play").Range("Y1").Interior.Color = vbGreen Then doubledown_me x, y, longrow, card, cardcount, int2
- If Sheets("play").Range("G1").Interior.Color = vbGreen Then doubledown_me2 x, y, longrow, card, cardcount, int2
- If Sheets("play").Range("K1").Interior.Color = vbGreen Then doubledown_me2 x, y, longrow, card, cardcount, int2
- If Sheets("play").Range("O1").Interior.Color = vbGreen Then doubledown_me2 x, y, longrow, card, cardcount, int2
- If Sheets("play").Range("S1").Interior.Color = vbGreen Then doubledown_me2 x, y, longrow, card, cardcount, int2
- If Sheets("play").Range("W1").Interior.Color = vbGreen Then doubledown_me2 x, y, longrow, card, cardcount, int2
- If Sheets("play").Range("AA1").Interior.Color = vbGreen Then doubledown_me2 x, y, longrow, card, cardcount, int2
- Sheets("play").Range(x & 4).Offset(0, 1) = cardcount
- If cardcount > 21 Then Sheets("play").Range(x & longrow + 5).Value = "BUST"
- Application.ScreenUpdating = True
- aces = 0
- Dim p As String, q As Long
- For q = 5 To 27 Step 2
- p = NumbersToColumns(q)
- Sheets("play").Range(p & 1).Interior.Color = RGB(205, 250, 253)
- Next q
- If Sheets("play").Cells(3, x).End(xlToRight).Column = 7 Then player1_split: Exit Sub
- If Sheets("play").Cells(3, x).End(xlToRight).Column = 11 Then player2_split: Exit Sub
- If Sheets("play").Cells(3, x).End(xlToRight).Column = 15 Then player3_split: Exit Sub
- If Sheets("play").Cells(3, x).End(xlToRight).Column = 19 Then player4_split: Exit Sub
- If Sheets("play").Cells(3, x).End(xlToRight).Column = 23 Then player5_split: Exit Sub
- If Sheets("play").Cells(3, x).End(xlToRight).Column = 27 Then player6_split: Exit Sub
- If Sheets("play").Cells(3, x).End(xlToRight).Column = 9 Then player2: Exit Sub
- If Sheets("play").Cells(3, x).End(xlToRight).Column = 13 Then player3: Exit Sub
- If Sheets("play").Cells(3, x).End(xlToRight).Column = 17 Then player4: Exit Sub
- If Sheets("play").Cells(3, x).End(xlToRight).Column = 21 Then player5: Exit Sub
- If Sheets("play").Cells(3, x).End(xlToRight).Column = 25 Then player6: Exit Sub
- stand2
- End Sub
- Sub doubledown_me(x As String, y As Long, longrow As Long, card As String, cardcount As Long, int2 As Long)
- ' doubledown player
- aces = 0
- longrow = Sheets("play").Cells(99, y).End(xlUp).Row
- Sheets("play").Range(x & 2).Value = Sheets("play").Range(x & 2).Value - Sheets("play").Range(x & 3).Value
- Sheets("play").Range(x & 3).Value = Sheets("play").Range(x & 3).Value + Sheets("play").Range(x & 3).Value
- For int2 = 5 To 6
- If Sheets("play").Range(x & int2).Value = "A" Then aceCount aces
- Next
- 'x = "E" ' player column
- 'y = 5 ' player column number
- 'z = "G" ' Split column
- 'aa = 16 ' A column cards
- 'bb = "I" ' player 2 column
- 'cc = 20
- 'dd = 39
- bCard = Sheets("play").Range("AG1").Value
- cRow = longrow + 1
- cCol = y
- InsertImage bCard, cRow, cCol
- Sheets("play").Range("Aj1:ak1").Copy Sheets("play").Range(x & longrow + 1)
- Sheets("play").Range("Ag1:ak1").Delete
- longrow = Sheets("play").Cells(99, y).End(xlUp).Row
- If Sheets("play").Range(x & longrow).Value = "A" Then aceCount aces
- doubledown_count x, longrow
- For int2 = 5 To longrow
- card = Sheets("play").Range(x & int2).Value
- If Sheets("play").Range(x & int2).Value = "J" Then card = 10
- If Sheets("play").Range(x & int2).Value = "Q" Then card = 10
- If Sheets("play").Range(x & int2).Value = "K" Then card = 10
- If Sheets("play").Range(x & int2).Value = "A" Then card = 11
- cardcount = cardcount + card
- longrow = Sheets("play").Cells(99, y).End(xlUp).Row
- If cardcount > 21 And aces > 0 Then cardcount = cardcount - 10: aces = aces - 1
- DoEvents
- Next int2
- Sheets("play").Range(x & 4).Offset(0, 1) = cardcount
- If cardcount > 21 Then Sheets("play").Range(x & longrow + 5).Value = "BUST"
- End Sub
- Sub doubledown_me2(x As String, y As Long, longrow As Long, card As String, cardcount As Long, int2 As Long)
- ' doubledown split
- aces = 0
- longrow = Sheets("play").Cells(99, y).End(xlUp).Row
- Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value - Sheets("play").Range(x & 3).Value
- Sheets("play").Range(x & 3).Value = Sheets("play").Range(x & 3).Value + Sheets("play").Range(x & 3).Value
- For int2 = 5 To 6
- If Sheets("play").Range(x & int2).Value = "A" Then aceCount aces
- Next
- bCard = Sheets("play").Range("AG1").Value
- cRow = longrow + 1
- cCol = y
- InsertImage bCard, cRow, cCol
- Sheets("play").Range("Aj1:ak1").Copy Sheets("play").Range(x & longrow + 1)
- Sheets("play").Range("Ag1:ak1").Delete
- longrow = Sheets("play").Cells(99, y).End(xlUp).Row
- If Sheets("play").Range(x & longrow).Value = "A" Then aceCount aces
- doubledown_count x, longrow
- For int2 = 5 To longrow
- card = Sheets("play").Range(x & int2).Value
- If Sheets("play").Range(x & int2).Value = "J" Then card = 10
- If Sheets("play").Range(x & int2).Value = "Q" Then card = 10
- If Sheets("play").Range(x & int2).Value = "K" Then card = 10
- If Sheets("play").Range(x & int2).Value = "A" Then card = 11
- cardcount = cardcount + card
- longrow = Sheets("play").Cells(99, y).End(xlUp).Row
- If cardcount > 21 And aces > 0 Then cardcount = cardcount - 10: aces = aces - 1
- DoEvents
- Next int2
- Sheets("play").Range(x & 4).Offset(0, 1) = cardcount
- If cardcount > 21 Then Sheets("play").Range(x & longrow + 5).Value = "BUST"
- End Sub
- Sub doubledown_count(x As String, longrow As Long) 'doubledown runningcount
- If Sheets("play").Range(x & longrow).Value = "A" Then Sheets("play").Range("AD3").Value = Sheets("play").Range("AD3").Value + 1
- If Sheets("play").Range(x & longrow).Value = "K" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range(x & longrow).Value = "Q" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range(x & longrow).Value = "J" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range(x & longrow).Value = "10" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range(x & longrow).Value = "2" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(x & longrow).Value = "3" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(x & longrow).Value = "4" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(x & longrow).Value = "5" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(x & longrow).Value = "6" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- End Sub
- Sub Finish()
- 'finish1
- End Sub
- Sub hit()
- 'hit1
- Dim x As String, y As Long, longrow As Long
- Application.ScreenUpdating = False
- Range("b1").Select
- Do
- If ActiveCell.Interior.Color = vbGreen Then Exit Do
- ActiveCell.Offset(0, 1).Select
- DoEvents
- Loop Until Selection.Address = Sheets("play").Range("ab1").Address
- If Selection.Address = Sheets("play").Range("ab1").Address Then Exit Sub
- If Sheets("play").Range("B1").Interior.Color = vbGreen Then x = "B"
- If Sheets("play").Range("B1").Interior.Color = vbGreen Then y = 2
- If Sheets("play").Range("E1").Interior.Color = vbGreen Then x = "E"
- If Sheets("play").Range("E1").Interior.Color = vbGreen Then y = 5
- If Sheets("play").Range("G1").Interior.Color = vbGreen Then x = "G"
- If Sheets("play").Range("G1").Interior.Color = vbGreen Then y = 7
- If Sheets("play").Range("I1").Interior.Color = vbGreen Then x = "I" ' player column number
- If Sheets("play").Range("I1").Interior.Color = vbGreen Then y = 9 ' player column
- If Sheets("play").Range("K1").Interior.Color = vbGreen Then x = "K" ' player column number
- If Sheets("play").Range("K1").Interior.Color = vbGreen Then y = 11 ' player column
- If Sheets("play").Range("M1").Interior.Color = vbGreen Then x = "M" ' player column number
- If Sheets("play").Range("M1").Interior.Color = vbGreen Then y = 13 ' player column
- If Sheets("play").Range("O1").Interior.Color = vbGreen Then x = "O" ' player column number
- If Sheets("play").Range("O1").Interior.Color = vbGreen Then y = 15 ' player column
- If Sheets("play").Range("Q1").Interior.Color = vbGreen Then x = "Q" ' player column number
- If Sheets("play").Range("Q1").Interior.Color = vbGreen Then y = 17 ' player column
- If Sheets("play").Range("S1").Interior.Color = vbGreen Then x = "S" ' player column number
- If Sheets("play").Range("S1").Interior.Color = vbGreen Then y = 19 ' player column
- If Sheets("play").Range("U1").Interior.Color = vbGreen Then x = "U" ' player column number
- If Sheets("play").Range("U1").Interior.Color = vbGreen Then y = 21 ' player column
- If Sheets("play").Range("W1").Interior.Color = vbGreen Then x = "W" ' player column number
- If Sheets("play").Range("W1").Interior.Color = vbGreen Then y = 23 ' player column
- If Sheets("play").Range("Y1").Interior.Color = vbGreen Then x = "Y" ' player column number
- If Sheets("play").Range("Y1").Interior.Color = vbGreen Then y = 25 ' player column
- If Sheets("play").Range("AA1").Interior.Color = vbGreen Then x = "AA" ' player column number
- If Sheets("play").Range("AA1").Interior.Color = vbGreen Then y = 27 ' player column
- hit_me x, y, longrow
- Application.ScreenUpdating = True
- End Sub
- Sub hit_me(x As String, y As Long, longrow As Long) 'aa As long,
- ' hit
- longrow = Sheets("play").Cells(99, y).End(xlUp).Row
- bCard = Sheets("play").Range("AG1").Value
- cRow = longrow + 1
- cCol = y
- InsertImage bCard, cRow, cCol
- Sheets("play").Range("Aj1:ak1").Copy Sheets("play").Range(x & longrow + 1)
- Sheets("play").Range("Af1:ak1").Delete
- longrow = Sheets("play").Cells(99, y).End(xlUp).Row
- hit_count x, longrow
- End Sub
- Sub hit_count(x As String, longrow As Long) 'hit runningcount
- If Sheets("play").Range(x & longrow).Value = "A" Then Sheets("play").Range("AD3").Value = Sheets("play").Range("AD3").Value + 1
- If Sheets("play").Range(x & longrow).Value = "K" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range(x & longrow).Value = "Q" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range(x & longrow).Value = "J" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range(x & longrow).Value = "10" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range(x & longrow).Value = "2" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(x & longrow).Value = "3" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(x & longrow).Value = "4" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(x & longrow).Value = "5" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range(x & longrow).Value = "6" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- End Sub
- Sub stand2()
- 'stand21
- Dim longrow As Long, card As String, cardcount As Long, int5 As Long, int6 As Long, q As Long, p As String
- Dim str1 As String, x As String, a As Long, ffffff As Long, cCard As String, dCard As String, cCell As Long
- Dim ColLet As String, colNum As Long, standCount As Long, RowNum As Long, boo As Boolean
- aces = 0
- Application.ScreenUpdating = False
- Sheets("play").Range("B1").Interior.Color = vbGreen
- longrow = Sheets("play").Range("B" & 99).End(xlUp).Row
- card = Sheets("play").Range("B5").Value
- If card = "A" Then aceCount aces
- If Sheets("play").Range("B5").Value = "J" Then card = 10
- If Sheets("play").Range("B5").Value = "Q" Then card = 10
- If Sheets("play").Range("B5").Value = "K" Then card = 10
- If Sheets("play").Range("B5").Value = "A" Then card = 11
- cardcount = cardcount + card
- card = Sheets("play").Range("B6").Value
- If card = "A" Then aceCount aces
- If Sheets("play").Range("B6").Value = "J" Then card = 10
- If Sheets("play").Range("B6").Value = "Q" Then card = 10
- If Sheets("play").Range("B6").Value = "K" Then card = 10
- If Sheets("play").Range("B6").Value = "A" Then card = 11
- cardcount = cardcount + card
- If cardcount > 21 And aces > 0 Then cardcount = cardcount - 10: aces = aces - 1
- 'stand2_count
- longrow = Sheets("play").Range("B" & 99).End(xlUp).Row
- If longrow = 6 And cardcount = 21 Then
- Sheets("play").Range("C4").Value = 21
- Sheets("play").Range("B11").Value = "BLACKJACK"
- Call tally
- GoTo LABEL
- End If
- If cardcount = 17 And aces > 0 And Sheets("play").Range("C1").Value = "Y" Then
- ColLet = "B": RowNum = 5: standCount = 18: card = 0
- colLoop ColLet, RowNum, standCount, cardcount, card
- Sheets("play").Range("C4").Value = cardcount
- longrow = Sheets("play").Range("B" & 99).End(xlUp).Row
- If cardcount > 21 Then Sheets("play").Range("b" & longrow + 5).Value = "BUST": Sheets("play").Range("C4").Value = ""
- Call tally
- GoTo LABEL
- End If
- If cardcount < 17 Then
- ColLet = "B": RowNum = 5: standCount = 17: card = 0
- colLoop ColLet, RowNum, standCount, cardcount, card
- Sheets("play").Range("C4").Value = cardcount
- longrow = Sheets("play").Range("B" & 99).End(xlUp).Row
- If cardcount > 21 Then Sheets("play").Range("b" & longrow + 5).Value = "BUST": Sheets("play").Range("C4").Value = ""
- Call tally
- GoTo LABEL
- End If
- If cardcount >= 17 Then
- Sheets("play").Range("C4").Value = cardcount
- Call tally
- GoTo LABEL
- End If
- LABEL:
- Application.ScreenUpdating = True
- For q = 5 To 27 Step 2
- p = NumbersToColumns(q)
- Sheets("play").Range(p & 1).Interior.Color = RGB(205, 250, 253)
- Next q
- myImage.Visible = True
- End Sub
- Sub tally()
- 'Tally1
- Dim a As Long, x As String, longrow As Long
- Application.ScreenUpdating = False
- For a = 5 To 28 Step 2
- x = NumbersToColumns(a)
- If Sheets("play").Range(x & 4).Offset(0, 1) <> "" Then
- longrow = Sheets("play").Range(x & 99).End(xlUp).Row
- If Sheets("play").Range(x & longrow).Value = "BLACKJACK" And Sheets("play").Range("B11").Value = "BLACKJACK" Then
- If x = "G" Then Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value: Sheets("play").Range(x & longrow + 1).Value = "PUSH": GoTo label2
- If x = "K" Then Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value: Sheets("play").Range(x & longrow + 1).Value = "PUSH": GoTo label2
- If x = "O" Then Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value: Sheets("play").Range(x & longrow + 1).Value = "PUSH": GoTo label2
- If x = "S" Then Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value: Sheets("play").Range(x & longrow + 1).Value = "PUSH": GoTo label2
- If x = "W" Then Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value: Sheets("play").Range(x & longrow + 1).Value = "PUSH": GoTo label2
- If x = "AA" Then Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value: Sheets("play").Range(x & longrow + 1).Value = "PUSH": GoTo label2
- Sheets("play").Range(x & longrow + 1).Value = "PUSH"
- Sheets("play").Range(x & 2).Value = Sheets("play").Range(x & 2).Value + Sheets("play").Range(x & 3).Value
- GoTo label2
- End If
- longrow = Sheets("play").Range(x & 99).End(xlUp).Row
- If Sheets("play").Range(x & longrow).Value = "BLACKJACK" Then
- If x = "G" Then Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value * 2.5: GoTo label2
- If x = "K" Then Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value * 2.5: GoTo label2
- If x = "O" Then Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value * 2.5: GoTo label2
- If x = "S" Then Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value * 2.5: GoTo label2
- If x = "W" Then Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value * 2.5: GoTo label2
- If x = "AA" Then Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value * 2.5: GoTo label2
- Sheets("play").Range(x & 2).Value = Sheets("play").Range(x & 2).Value + Sheets("play").Range(x & 3).Value * 2.5: GoTo label2
- End If
- If Sheets("play").Range("C4").Value = Sheets("play").Range(x & 4).Offset(0, 1).Value Then
- longrow = Sheets("play").Range(x & 99).End(xlUp).Row
- Sheets("play").Range(x & longrow + 5).Value = "PUSH"
- If x = "G" Then Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value: GoTo label2
- If x = "K" Then Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value: GoTo label2
- If x = "O" Then Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value: GoTo label2
- If x = "S" Then Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value: GoTo label2
- If x = "W" Then Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value: GoTo label2
- If x = "AA" Then Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value: GoTo label2
- Sheets("play").Range(x & 2).Value = Sheets("play").Range(x & 2).Value + Sheets("play").Range(x & 3).Value
- End If
- If Sheets("play").Range(x & longrow).Value = "BLACKJACK" Then GoTo label2
- If Sheets("play").Range("C4").Value < Sheets("play").Range(x & 4).Offset(0, 1).Value And Sheets("play").Range(x & 4).Offset(0, 1).Value < 22 Then
- longrow = Sheets("play").Range(x & 99).End(xlUp).Row
- Sheets("play").Range(x & longrow + 5).Value = "WINNER"
- If x = "G" Then Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value * 2: GoTo label2
- If x = "K" Then Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value * 2: GoTo label2
- If x = "O" Then Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value * 2: GoTo label2
- If x = "S" Then Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value * 2: GoTo label2
- If x = "W" Then Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value * 2: GoTo label2
- If x = "AA" Then Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value * 2: GoTo label2
- Sheets("play").Range(x & 2).Value = Sheets("play").Range(x & 2).Value + Sheets("play").Range(x & 3).Value * 2
- End If
- label2:
- End If
- DoEvents
- Next a
- aces = 0
- stand2_count
- Application.ScreenUpdating = True
- End Sub
- Sub stand2_count()
- If Sheets("play").Range("b5").Value = "A" Then Sheets("play").Range("AD3").Value = Sheets("play").Range("AD3").Value + 1
- If Sheets("play").Range("b5").Value = "K" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range("b5").Value = "Q" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range("b5").Value = "J" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range("b5").Value = "10" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range("b5").Value = "2" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range("b5").Value = "3" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range("b5").Value = "4" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range("b5").Value = "5" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range("b5").Value = "6" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range("b6").Value = "A" Then Sheets("play").Range("AD3").Value = Sheets("play").Range("AD3").Value + 1
- If Sheets("play").Range("b6").Value = "K" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range("b6").Value = "Q" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range("b6").Value = "J" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range("b6").Value = "10" Then Sheets("play").Range("AD2").Value = Sheets("play").Range("AD2").Value + 1
- If Sheets("play").Range("b6").Value = "2" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range("b6").Value = "3" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range("b6").Value = "4" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range("b6").Value = "5" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- If Sheets("play").Range("b6").Value = "6" Then Sheets("play").Range("AD4").Value = Sheets("play").Range("AD4").Value + 1
- End Sub
- Sub insurance()
- Dim a As Long, x As Long, y As String, result As Byte
- 'Application.ScreenUpdating = False
- For a = 5 To 27 Step 2
- y = NumbersToColumns(a)
- If Sheets("play").Range(y & 3).Value = "" Then GoTo LABEL
- If Sheets("play").Range("h1").Value = "Y" And Sheets("play").Range("ad6").Value >= 3 Then GoTo label2
- If Sheets("play").Range("h1").Value = "Y" And Sheets("play").Range("ad6").Value <= 3 Then GoTo LABEL
- result = MsgBox("Insurance?", vbYesNo)
- If result = 6 Then
- label2:
- Sheets("play").Range(y & 2).Value = Sheets("play").Range(y & 2).Value - Sheets("play").Range(y & 3).Value * 0.5
- Sheets("play").Range(y & 3).Value = Sheets("play").Range(y & 3).Value + Sheets("play").Range(y & 3).Value * 0.5
- Sheets("play").Range(y & 7).Value = "Insurance"
- End If
- LABEL:
- DoEvents
- Next a
- 'Application.ScreenUpdating = True
- End Sub
- Sub CardCounter(card As String, cardcount As Long, ColLet, RowNum)
- 'cardcounter1
- Dim longrow As Long
- longrow = Sheets("play").Range(ColLet & 99).End(xlUp).Row
- cardcount = 0
- card = 0
- RowNum = 5
- Do Until Sheets("play").Range(ColLet & RowNum).Value = ""
- If Sheets("play").Range(ColLet & RowNum).Value = "A" Then aceCount aces
- If Sheets("play").Range(ColLet & RowNum).Value = "A" Then card = 11
- If Sheets("play").Range(ColLet & RowNum).Value = "K" Then card = 10
- If Sheets("play").Range(ColLet & RowNum).Value = "Q" Then card = 10
- If Sheets("play").Range(ColLet & RowNum).Value = "J" Then card = 10
- If Sheets("play").Range(ColLet & RowNum).Value = 10 Then card = 10
- If Sheets("play").Range(ColLet & RowNum).Value = 9 Then card = 9
- If Sheets("play").Range(ColLet & RowNum).Value = 8 Then card = 8
- If Sheets("play").Range(ColLet & RowNum).Value = 7 Then card = 7
- If Sheets("play").Range(ColLet & RowNum).Value = 6 Then card = 6
- If Sheets("play").Range(ColLet & RowNum).Value = 5 Then card = 5
- If Sheets("play").Range(ColLet & RowNum).Value = 4 Then card = 4
- If Sheets("play").Range(ColLet & RowNum).Value = 3 Then card = 3
- If Sheets("play").Range(ColLet & RowNum).Value = 2 Then card = 2
- If cardcount > 21 And aces > 0 Then cardcount = cardcount - 10: aces = aces - 1
- cardcount = cardcount + card
- RowNum = RowNum + 1
- DoEvents
- Loop
- End Sub
- Sub stand()
- 'stand1
- Dim x As Long, y As String, z As String, aa As Long
- Dim longrow As Long, int2 As Long, card As String, cardcount As Long
- Application.ScreenUpdating = False
- Range("e1").Select
- Do
- If ActiveCell.Interior.Color = vbGreen Then Exit Do
- ActiveCell.Offset(0, 1).Select
- DoEvents
- Loop Until Selection.Address = Sheets("play").Range("ab1").Address
- If Selection.Address = Sheets("play").Range("ab1").Address Then Exit Sub
- If Sheets("play").Range("E1").Interior.Color = vbGreen Then x = 5 ' player column number
- If Sheets("play").Range("E1").Interior.Color = vbGreen Then y = "E" ' player column
- If Sheets("play").Range("G1").Interior.Color = vbGreen Then x = 7 ' player column number
- If Sheets("play").Range("G1").Interior.Color = vbGreen Then y = "G" ' player column
- If Sheets("play").Range("I1").Interior.Color = vbGreen Then x = 9 ' player column number
- If Sheets("play").Range("I1").Interior.Color = vbGreen Then y = "I" ' player column
- If Sheets("play").Range("K1").Interior.Color = vbGreen Then x = 11 ' player column number
- If Sheets("play").Range("K1").Interior.Color = vbGreen Then y = "K" ' player column
- If Sheets("play").Range("M1").Interior.Color = vbGreen Then x = 13 ' player column number
- If Sheets("play").Range("M1").Interior.Color = vbGreen Then y = "M" ' player column
- If Sheets("play").Range("O1").Interior.Color = vbGreen Then x = 15 ' player column number
- If Sheets("play").Range("O1").Interior.Color = vbGreen Then y = "O" ' player column
- If Sheets("play").Range("Q1").Interior.Color = vbGreen Then x = 17 ' player column number
- If Sheets("play").Range("Q1").Interior.Color = vbGreen Then y = "Q" ' player column
- If Sheets("play").Range("S1").Interior.Color = vbGreen Then x = 19 ' player column number
- If Sheets("play").Range("S1").Interior.Color = vbGreen Then y = "S" ' player column
- If Sheets("play").Range("U1").Interior.Color = vbGreen Then x = 21 ' player column number
- If Sheets("play").Range("U1").Interior.Color = vbGreen Then y = "U" ' player column
- If Sheets("play").Range("W1").Interior.Color = vbGreen Then x = 23 ' player column number
- If Sheets("play").Range("W1").Interior.Color = vbGreen Then y = "W" ' player column
- If Sheets("play").Range("Y1").Interior.Color = vbGreen Then x = 25 ' player column number
- If Sheets("play").Range("Y1").Interior.Color = vbGreen Then y = "Y" ' player column
- If Sheets("play").Range("AA1").Interior.Color = vbGreen Then x = 27 ' player column number
- If Sheets("play").Range("AA1").Interior.Color = vbGreen Then y = "AA" ' player column
- If Sheets("play").Range("E5").Value = "" Then MsgBox ("You have not bet yet"): Exit Sub
- On Error Resume Next
- stand_me longrow, int2, card, cardcount, y, x
- On Error Resume Next
- stand_me2 longrow, int2, card, cardcount, z, aa
- Application.ScreenUpdating = True
- aces = 0
- Dim p As String, q As Long
- For q = 5 To 27 Step 2
- p = NumbersToColumns(q)
- Sheets("play").Range(p & 1).Interior.Color = RGB(205, 250, 253)
- Next q
- If Sheets("play").Cells(3, x).End(xlToRight).Column = 7 Then player1_split: Exit Sub
- If Sheets("play").Cells(3, x).End(xlToRight).Column = 11 Then player2_split: Exit Sub
- If Sheets("play").Cells(3, x).End(xlToRight).Column = 15 Then player3_split: Exit Sub
- If Sheets("play").Cells(3, x).End(xlToRight).Column = 19 Then player4_split: Exit Sub
- If Sheets("play").Cells(3, x).End(xlToRight).Column = 23 Then player5_split: Exit Sub
- If Sheets("play").Cells(3, x).End(xlToRight).Column = 27 Then player6_split: Exit Sub
- If Sheets("play").Cells(3, x).End(xlToRight).Column = 9 Then player2: Exit Sub
- If Sheets("play").Cells(3, x).End(xlToRight).Column = 13 Then player3: Exit Sub
- If Sheets("play").Cells(3, x).End(xlToRight).Column = 17 Then player4: Exit Sub
- If Sheets("play").Cells(3, x).End(xlToRight).Column = 21 Then player5: Exit Sub
- If Sheets("play").Cells(3, x).End(xlToRight).Column = 25 Then player6: Exit Sub
- stand2
- End Sub
- Sub stand_me(longrow As Long, int2 As Long, card As String, cardcount As Long, y As String, x As Long)
- ' standme1
- aces = 0
- longrow = Sheets("play").Cells(99, x).End(xlUp).Row
- For int2 = 5 To longrow
- If Sheets("play").Range(y & int2).Value = "A" Then aceCount aces
- Next
- For int2 = 5 To longrow
- card = Sheets("play").Range(y & int2).Value
- If Sheets("play").Range(y & int2).Value = "J" Then card = 10
- If Sheets("play").Range(y & int2).Value = "Q" Then card = 10
- If Sheets("play").Range(y & int2).Value = "K" Then card = 10
- If Sheets("play").Range(y & int2).Value = "A" Then card = 11
- cardcount = cardcount + card
- If int2 = 6 And cardcount = 21 Then
- Sheets("play").Range(y & longrow + 5).Value = "BLACKJACK": GoTo LABEL
- End If
- If cardcount > 21 And aces > 0 Then cardcount = cardcount - 10: aces = aces - 1
- If cardcount > 21 And aces > 0 Then cardcount = cardcount - 10: aces = aces - 1
- DoEvents
- label2:
- Next int2
- LABEL:
- longrow = Sheets("play").Cells(99, x).End(xlUp).Row
- Sheets("play").Range(y & 4).Offset(0, 1) = cardcount
- If cardcount > 21 Then Sheets("play").Range(y & longrow + 5).Value = "BUST"
- End Sub
- Sub stand_me2(longrow As Long, int2 As Long, card As String, cardcount As Long, z As String, aa As Long)
- ' standme2
- aces = 0
- longrow = Sheets("play").Cells(99, aa).End(xlUp).Row
- For int2 = 5 To longrow
- If Sheets("play").Range(z & int2).Value = "A" Then aceCount aces
- Next
- For int2 = 5 To longrow
- card = Sheets("play").Range(z & int2).Value
- If Sheets("play").Range(z & int2).Value = "J" Then card = 10
- If Sheets("play").Range(z & int2).Value = "Q" Then card = 10
- If Sheets("play").Range(z & int2).Value = "K" Then card = 10
- If Sheets("play").Range(z & int2).Value = "A" Then card = 11
- cardcount = cardcount + card
- If int2 = 6 And cardcount = 21 Then
- Sheets("play").Range(z & longrow + 5).Value = "BLACKJACK": GoTo LABEL
- End If
- If cardcount > 21 And aces > 0 Then cardcount = cardcount - 10: aces = aces - 1
- If cardcount > 21 And aces > 0 Then cardcount = cardcount - 10: aces = aces - 1
- DoEvents
- label2:
- Next int2
- If cardcount > 21 Then Sheets("play").Range(z & longrow + 5).Value = "BUST"
- LABEL:
- Sheets("play").Range(z & 4).Offset(0, 1) = cardcount
- End Sub
- Sub surrender()
- 'surrender1
- Dim x As String, y As Long
- Application.ScreenUpdating = False
- Range("e1").Select
- Do
- If ActiveCell.Interior.Color = vbGreen Then Exit Do
- ActiveCell.Offset(0, 1).Select
- DoEvents
- Loop Until Selection.Address = Sheets("play").Range("ab1").Address
- If Selection.Address = Sheets("play").Range("ab1").Address Then Exit Sub
- If Sheets("play").Range("E1").Interior.Color = vbGreen Then x = "E" ' player column number
- If Sheets("play").Range("E1").Interior.Color = vbGreen Then y = 5 ' player column
- If Sheets("play").Range("G1").Interior.Color = vbGreen Then x = "G" ' player column number
- If Sheets("play").Range("G1").Interior.Color = vbGreen Then y = 7 ' player column
- If Sheets("play").Range("I1").Interior.Color = vbGreen Then x = "I" ' player column number
- If Sheets("play").Range("I1").Interior.Color = vbGreen Then y = 9 ' player column
- If Sheets("play").Range("K1").Interior.Color = vbGreen Then x = "K" ' player column number
- If Sheets("play").Range("K1").Interior.Color = vbGreen Then y = 11 ' player column
- If Sheets("play").Range("M1").Interior.Color = vbGreen Then x = "M" ' player column number
- If Sheets("play").Range("M1").Interior.Color = vbGreen Then y = 13 ' player column
- If Sheets("play").Range("O1").Interior.Color = vbGreen Then x = "O" ' player column number
- If Sheets("play").Range("O1").Interior.Color = vbGreen Then y = 15 ' player column
- If Sheets("play").Range("Q1").Interior.Color = vbGreen Then x = "Q" ' player column number
- If Sheets("play").Range("Q1").Interior.Color = vbGreen Then y = 17 ' player column
- If Sheets("play").Range("S1").Interior.Color = vbGreen Then x = "S" ' player column number
- If Sheets("play").Range("S1").Interior.Color = vbGreen Then y = 19 ' player column
- If Sheets("play").Range("U1").Interior.Color = vbGreen Then x = "U" ' player column number
- If Sheets("play").Range("U1").Interior.Color = vbGreen Then y = 21 ' player column
- If Sheets("play").Range("W1").Interior.Color = vbGreen Then x = "W" ' player column number
- If Sheets("play").Range("W1").Interior.Color = vbGreen Then y = 3 ' player column
- If Sheets("play").Range("Y1").Interior.Color = vbGreen Then x = "Y" ' player column number
- If Sheets("play").Range("Y1").Interior.Color = vbGreen Then y = 25 ' player column
- If Sheets("play").Range("AA1").Interior.Color = vbGreen Then x = "AA" ' player column number
- If Sheets("play").Range("AA1").Interior.Color = vbGreen Then y = 27 ' player column
- If Sheets("play").Range("E1").Interior.Color = vbGreen Then
- Sheets("play").Range(x & 2).Value = Sheets("play").Range(x & 2).Value + Sheets("play").Range(x & 3).Value * 0.5
- Sheets("play").Range(x & 3).ClearContents
- End If
- If Sheets("play").Range("I1").Interior.Color = vbGreen Then
- Sheets("play").Range(x & 2).Value = Sheets("play").Range(x & 2).Value + Sheets("play").Range(x & 3).Value * 0.5
- Sheets("play").Range(x & 3).ClearContents
- End If
- If Sheets("play").Range("M1").Interior.Color = vbGreen Then
- Sheets("play").Range(x & 2).Value = Sheets("play").Range(x & 2).Value + Sheets("play").Range(x & 3).Value * 0.5
- Sheets("play").Range(x & 3).ClearContents
- End If
- If Sheets("play").Range("Q1").Interior.Color = vbGreen Then
- Sheets("play").Range(x & 2).Value = Sheets("play").Range(x & 2).Value + Sheets("play").Range(x & 3).Value * 0.5
- Sheets("play").Range(x & 3).ClearContents
- End If
- If Sheets("play").Range("U1").Interior.Color = vbGreen Then
- Sheets("play").Range(x & 2).Value = Sheets("play").Range(x & 2).Value + Sheets("play").Range(x & 3).Value * 0.5
- Sheets("play").Range(x & 3).ClearContents
- End If
- If Sheets("play").Range("Y1").Interior.Color = vbGreen Then
- Sheets("play").Range(x & 2).Value = Sheets("play").Range(x & 2).Value + Sheets("play").Range(x & 3).Value * 0.5
- Sheets("play").Range(x & 3).ClearContents
- End If
- If Sheets("play").Range("G1").Interior.Color = vbGreen Then
- Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value * 0.5
- Sheets("play").Range(x & 3).ClearContents
- End If
- If Sheets("play").Range("K1").Interior.Color = vbGreen Then
- Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value * 0.5
- Sheets("play").Range(x & 3).ClearContents
- End If
- If Sheets("play").Range("O1").Interior.Color = vbGreen Then
- Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value * 0.5
- Sheets("play").Range(x & 3).ClearContents
- End If
- If Sheets("play").Range("S1").Interior.Color = vbGreen Then
- Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value * 0.5
- Sheets("play").Range(x & 3).ClearContents
- End If
- If Sheets("play").Range("W1").Interior.Color = vbGreen Then
- Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value * 0.5
- Sheets("play").Range(x & 3).ClearContents
- End If
- If Sheets("play").Range("AA1").Interior.Color = vbGreen Then
- Sheets("play").Range(x & 2).Offset(0, -2).Value = Sheets("play").Range(x & 2).Offset(0, -2).Value + Sheets("play").Range(x & 3).Value * 0.5
- Sheets("play").Range(x & 3).ClearContents
- End If
- 'If Sheets("play").Range(x & 3).End(xlToRight).Column = 29 Then
- '
- ' Sheets("play").Range(x & 1).Interior.Color = RGB(205, 250, 253)
- '
- ' stand2
- '
- ' Exit Sub
- 'End If
- stand
- Application.ScreenUpdating = True
- End Sub
- Sub InsertImage(ByVal cCard As String, cRow As Long, cCol As Long) ', dCard As String
- 'insertimage1
- Dim ws As Worksheet
- Set ws = Sheets("play")
- Dim imagePath As String
- Dim imgLeft As Double
- Dim imgTop As Double
- Dim a As Long, b As String
- a = Cells(14, 1).Value
- b = Cells(14, 2).Value
- Set ws = ActiveSheet
- 'PUT IN CARD PATH HERE BETWEEN THE FIRST 2 QUOTES:
- imagePath = ws.Cells(20, 1).Value & "\" & cCard & ".png"
- 'YOU CAN GET RID OF ENVIRON("userprofile") IF YOU WANT, I HAVE MORE THAT ONE COMP... THAT'S WHY I GOT IT THERE
- imgLeft = Sheets("play").Cells(cRow, cCol).Left
- imgTop = Sheets("play").Cells(cRow, cCol).Top
- 'Width & Height = -1 means keep original size
- ws.Shapes.AddPicture _
- Filename:=imagePath, _
- LinkToFile:=msoFalse, _
- SaveWithDocument:=msoTrue, _
- Left:=imgLeft, _
- Top:=imgTop, _
- Width:=50, _
- Height:=83
- 'C:\Users\Administrator1\OneDrive\excel\cards
- 'sheets("play").Cells(5, 2) = myImage.Visible = msoFalse
- 'C:\Users\actor\OneDrive\excel\cards
- 'Environ("userprofile") & "\OneDrive\excel\cards"
- End Sub
Add Comment
Please, Sign In to add comment