rrosenwald
New Member
- Joined
- Jul 7, 2012
- Messages
- 7
I have a macro that finds the last row in a spreadsheet and then moves down a column 1 row at a time to check if the current cell is empty. If it is, then it copies the value from the cell immediately above and then continues moving down. I have run this macro on the same worksheet on multiple machines and on some, but not all, I get a spinner culminating with the message shown below. All machines have Windows 10 and either 8 or 16 GB memory and are running pretty much the same basic software (I use them all in various locations and at different times). Can anyone help me figure out what is going on?
VBA Code:
Sub FillBlankCells()
Dim LastRow As Long
Dim x As Integer
Application.ScreenUpdating = False
Application.CutCopyMode = False
ActiveCell.Offset(0, 1).Range("A1").Select
' Find the last row
LastRow = Cells(Rows.Count, 4).End(xlUp).Row
For x = 1 To LastRow
If IsEmpty(ActiveCell) Then
ActiveCell.Offset(-1, 0).Copy
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats
ActiveCell.Offset(1, 0).Select
Else
ActiveCell.Offset(1, 0).Select
End If
Next x
Application.ScreenUpdating = True
End Sub
Last edited by a moderator: