I'm using the following code to prompt the user for a variable and add that to each row at the end. For some reason, the number in the last line is the number that fills all the cells. Is there a way to fix this code?
Dim lr As Long
Dim myRange As Integer
myRange = Application.InputBox("Enter Item Number", Type:=1)
lr = Cells(rows.Count, "A").End(xlUp).Row
Range("O2:O" & lr).Value = Format(myRange, "1")
You defined your range from O2
to O" & lr
.
Range("O" & lr).Value = Format(myRange, "1")
Or
Cells(rows.Count, "A").End(xlUp).Offset(1).Value = Format(myRange, "1")