I'm trying to create a simple counting sheet which has 5 buttons to increment the count of each field,
a 'New Round' Button to start a new round in a new column (R2 and so forth)
and Clear button which clears all the counts and start over again from Round1
The code works fine, but it clears the entire columns so that means the totals and grand total also gets cleared. How do I prevent this from happening by not specifying .EntireColumn attribute and instead a specific range?
Function rngLastRound() As Range With Range("2:2").Cells(1, Columns.Count).End(xlToLeft) Set rngLastRound = .EntireColumn End With End Function Sub IncrementCurrentRoundOfRow(N As Long) With rngLastRound .Cells(N, 1).Value = Val(CStr(.Cells(N, 1).Value)) + 1 End With End Sub Sub IncrementCurrentRoundA() Call IncrementCurrentRoundOfRow(3) End Sub Sub IncrementCurrentRoundB() Call IncrementCurrentRoundOfRow(4) End Sub Sub IncrementCurrentRoundC() Call IncrementCurrentRoundOfRow(5) End Sub Sub IncrementCurrentRoundD() Call IncrementCurrentRoundOfRow(6) End Sub Sub IncrementCurrentRoundE() Call IncrementCurrentRoundOfRow(7) End Sub Sub NewRound() With rngLastRound.Offset(0, 1) .Cells(2, 1).Value = "R" & (.Column - 1) .Cells(3, 1).Resize(5, 1).Value = 0 End With End Sub Sub Clear() Range("B2", rngLastRound).ClearContents Call NewRound End Sub