VictoriaLJones
Technical User
Hi,
I have writen some code in order to copy down the previous cells contents, from a selected row, however I need it to stop when it finds the last row. At the moment it just keeps going and going and...... etc!!!
I know there is a find last row and Used Range property, but I am unsure as to how to incorporate them into my code.
Any help gratefully received!! I have copied the code below.
Thanks
Victoria
Dim oCell as Range
For Each oCell In Selection.Cells
If IsEmpty(oCell) Then
oCell.Offset(-1, 0).Activate
ActiveCell.Copy
oCell.Offset(0, 0).PasteSpecial (xlPasteAll)
Else:
End If
Next
I have writen some code in order to copy down the previous cells contents, from a selected row, however I need it to stop when it finds the last row. At the moment it just keeps going and going and...... etc!!!
I know there is a find last row and Used Range property, but I am unsure as to how to incorporate them into my code.
Any help gratefully received!! I have copied the code below.
Thanks
Victoria
Dim oCell as Range
For Each oCell In Selection.Cells
If IsEmpty(oCell) Then
oCell.Offset(-1, 0).Activate
ActiveCell.Copy
oCell.Offset(0, 0).PasteSpecial (xlPasteAll)
Else:
End If
Next