I have a button on one of my sheets to allow the user to add rows. An input box pops up and asks them how many rows they would like to add.
Here's my code:
The line that beings with ActiveCell is throwing the error. I am 99% sure I tested this code the other day and it worked fine. So I am not sure why it suddenly doesn't work. Any ideas?
BTW, I'm using Excel 2016.
Here's my code:
Code:
Sub AddRows_Button()
Dim NumberOfRowsInLog As Integer
Dim LastRowInLog As Integer
Dim RowsToAdd As Variant
NumberOfRowsInLog = Range("Number_of_Rows_currently").Value
LastRowInLog = 8 + NumberOfRowsInLog
RowsToAdd = InputBox("How many rows would you like to add?")
If Not IsNumeric(RowsToAdd) Then
MsgBox "You must enter a number in order to add rows."
Else
Range("B" & LastRowInLog + 1).Select
ActiveCell.EntireRow.Resize(Int(RowsToAdd)).Insert
End If
The line that beings with ActiveCell is throwing the error. I am 99% sure I tested this code the other day and it worked fine. So I am not sure why it suddenly doesn't work. Any ideas?
BTW, I'm using Excel 2016.