No Carim, you fixed my problem. YOU, sir, are a very kind and generous person!
Thank you so much Carim, you are a Legend!!
No problem ... it should not take too long to fix ...
I have attached the excel book along with the macros. All I need now is to update the ranges ( see the "required" sheet) but somehow I'm not able to do it properly.
Could you please help me out?
Thanks so much!
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?Code
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