The code fails on:
So you are trying to put the value of the textbox into Colum "C" at Row "R". The value of R is actually blank or empty and needs to be set.
R is set with the following code.
Which basically means, take the value from Cell A1 on the active sheet and set R to that value.
Cell A1 is currently blank. If you put a number in Cell A1 that represents a row number then the code will work.
I suspect there was a formula in "A1" in the workbook or sheet that you copied this from, and that formula would return the last row in the table
I suspect the formula was something like:
You may not be able to see the formula because the font is set to white on a white background.