JenniferMurphy
Well-known Member
- Joined
- Jul 23, 2011
- Messages
- 2,691
- Office Version
- 365
- Platform
- Windows
I want to create a little score sheet for Connect 4 games with my granddaughter. Here's the table:
As each game is played, we will click on one of two button form controls: Susie or Gramma. The macro called will add a new row at the top, enter the name of the winner in the first column, and increment the score for that person, keeping the score for the other one constant.
The mini-sheet does not show the named ranges, so here's a screen shot of the Name Manager:
And here's the macro code I have so far:
This all works except for the last statement where I am trying to save the text string "Susie" in the Winner column.
Can someone tell me what I am doing wrong?
Thanks
Connect 4 Scores.xlsm | |||||
---|---|---|---|---|---|
B | C | D | |||
4 | Winner | Susie | Gramma | ||
5 | Gramma | 2 | 1 | ||
6 | Susie | 2 | 0 | ||
7 | Susie | 1 | 0 | ||
8 | 0 | 0 | |||
Sheet1 |
As each game is played, we will click on one of two button form controls: Susie or Gramma. The macro called will add a new row at the top, enter the name of the winner in the first column, and increment the score for that person, keeping the score for the other one constant.
The mini-sheet does not show the named ranges, so here's a screen shot of the Name Manager:
And here's the macro code I have so far:
VBA Code:
Option Explicit
' Global Constants
' Set the range names that we will need
Public Const rnWinnerHdr As String = "WinnerHdr"
Public Const rnSusieHdr As String = "SusieHdr"
Public Const rnGrammaHdr As String = "GrammaHdr"
'==============================================================
' Score a win for Susie
'==============================================================
Sub ScoreSusie()
Dim rWinnerHdr As Range
Set rWinnerHdr = Range(rnWinnerHdr)
Dim Row1 As Long
Row1 = rWinnerHdr.Row + 1
Rows(Row1).Select
Selection.Insert Shift:=xlDown
Range(rWinnerHdr).Offset(1, 0).Value = "Susie"
End Sub
Can someone tell me what I am doing wrong?
Thanks