Hi all,
I play poker and I use an excel with specific ranges of cards. The cards you will call a bet depends on the position of the raiser and the position you are calling. I have matrix with the cards with named ranges
The position´s name are:
EP
MP
CO
BTN
SB
BB
So if the EP open raise with a bet and I am sitting at MP, I have a range called Call_MP_vs_EP
So I did 2 columns of buttons that assign the respective string to a cell ( here, P40 and Q40)and the I have a button that run a macro to call the specific range
The Macro is below. I am wondering if there is a smarter way to do it
And it is not possible to have the same positions, for instance EP vs EP
Private Sub MP_Click()
' range call of MP vs EP
Dim Raise As Variant
Dim vscall As Variant
Dim atencao As String
'vscall = define caller position
'Raise = define raiser position
vscall = Sheets("Dashboard").Range("p40").Value
Raise = Sheets("Dashboard").Range("q40").Value
Application.ScreenUpdating = False
'delete previous range
Sheets("Dashboard").Range("B3:N20").Delete
'Not possible to have 2 positions at same time, then go to error msg
On Error GoTo atencao
'Select, copy and past the defined range based on Q40 and P40 cell value
Application.Range("Call_" & vscall & "_vs_" & Raise).Copy
Sheets("Dashboard").Select
Sheets("Dashboard").Range("B4").Select
Selection.PasteSpecial Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone _
, SkipBlanks:=False, Transpose:=False
On Error GoTo atencao
Range("A1").Select
Application.ScreenUpdating = True
atencao: MsgBox "ranges inválidos"
End Sub
I play poker and I use an excel with specific ranges of cards. The cards you will call a bet depends on the position of the raiser and the position you are calling. I have matrix with the cards with named ranges
The position´s name are:
EP
MP
CO
BTN
SB
BB
So if the EP open raise with a bet and I am sitting at MP, I have a range called Call_MP_vs_EP
So I did 2 columns of buttons that assign the respective string to a cell ( here, P40 and Q40)and the I have a button that run a macro to call the specific range
The Macro is below. I am wondering if there is a smarter way to do it
And it is not possible to have the same positions, for instance EP vs EP
Private Sub MP_Click()
' range call of MP vs EP
Dim Raise As Variant
Dim vscall As Variant
Dim atencao As String
'vscall = define caller position
'Raise = define raiser position
vscall = Sheets("Dashboard").Range("p40").Value
Raise = Sheets("Dashboard").Range("q40").Value
Application.ScreenUpdating = False
'delete previous range
Sheets("Dashboard").Range("B3:N20").Delete
'Not possible to have 2 positions at same time, then go to error msg
On Error GoTo atencao
'Select, copy and past the defined range based on Q40 and P40 cell value
Application.Range("Call_" & vscall & "_vs_" & Raise).Copy
Sheets("Dashboard").Select
Sheets("Dashboard").Range("B4").Select
Selection.PasteSpecial Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone _
, SkipBlanks:=False, Transpose:=False
On Error GoTo atencao
Range("A1").Select
Application.ScreenUpdating = True
atencao: MsgBox "ranges inválidos"
End Sub
Last edited: