Advertisement
turtlearegood

Checkers

Oct 31st, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
  2. 'Code that needs to be run for the piece
  3. 'Code to handle picking macro to run for the piece
  4. 'NOTE this is and an event not a macro
  5. 'Before double click ........blablabla
  6. If ActiveCell.Column > 9 Then
  7. If ActiveCell.Column < 18 Then
  8. If ActiveCell.Row < 9 Then
  9. If ActiveCell.Value <> "" Then
  10. If Cells(1, 1).Value = 1 Then
  11. Cells(1, 2).Value = ActiveCell.Row
  12. Cells(1, 3).Value = ActiveCell.Column
  13. End If
  14. End If
  15. '*******test if it works if not use code:*******
  16. 'Target.Value = Target
  17.    Select Case Target.Value
  18.         Case "W"    'a normal white piece
  19.            If Cells(1, 1).Value = 1 Then
  20.                 Range("J21:Q28").Clear
  21.                 Call NormalWhitePiece
  22.                 Cells(1, 1).Value = 2
  23.             End If
  24.         Case "W*"   'a kinged white piece
  25.            If Cells(1, 1).Value = 1 Then
  26.                 Range("J21:Q28").Clear
  27.                 Call KingedWhitePiece
  28.                 Cells(1, 1).Value = 2
  29.             End If
  30.         Case "B"    'a normal black piece
  31.            If Cells(1, 1).Value = 1 Then
  32.                 Range("J21:Q28").Clear
  33.                 Call NormalBlackPiece
  34.                 Cells(1, 1).Value = 2
  35.             End If
  36.         Case "B*"   'kinged black piece
  37.            If Cells(1, 1).Value = 1 Then
  38.                 Range("J21:Q28").Clear
  39.                 Call KingedBlackPiece
  40.                 Cells(1, 1).Value = 2
  41.             End If
  42.         Case "" 'A blank Space
  43.            If Cells(1, 1).Value = 2 Then
  44.                 Call MoveToLocation
  45.                 Cells(1, 1).Value = 1
  46.             End If
  47.     End Select
  48. End If
  49. End If
  50. End If
  51. EndOf:
  52. 'End of code handling macro selection
  53. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement