I am trying to replace the contents of certain cells with the rounded of the same amounts currently there. The error is on the line where I define the LastRow variable (within the With/End With command). The weird thing is, this code used to work fine a few weeks ago.
Here is my code:
Dim LastRow As Integer
' Looks up the last row of data and assigns it to one of the variables on columns I and J
With ActiveWorksheet
LastRow = .Range("I" & .Rows.Count).End(xlUp).Row
End With
Set rng = Range("I2:J" & LastRow)
' Replaces current contents of columns I and J with the same value but rounded to 2 decimals
For Each cell In rng
If cell = "" Then Exit Sub
cell.Value = WorksheetFunction.Round(cell.Value, 2)
Next cell