Last active
April 16, 2017 15:41
-
-
Save ateneva/667fde1e25b49b9a8c7399ee1a368762 to your computer and use it in GitHub Desktop.
Fill empty cells with values from the previous cells
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub FillInEmptyCellWithPrevious() | |
Dim Cell As Range | |
Dim Region As Range | |
Set Region = Worksheets("Extract").Range(Cells(3, 1), Cells(ActiveSheet.UsedRange.Rows.Count, 3, 3)) | |
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
'written by Angelina Teneva, September 2016 | |
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
For Each Cell In Region | |
If IsEmpty(Cell.Value) Then Cell.Offset(-1, 0).Select 'if cell is empty then put the value from the previous cell | |
Selection.Copy ActiveCell.Offset(1, 0) | |
Next Cell | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment