Skip to content

Instantly share code, notes, and snippets.

@ateneva
Last active April 16, 2017 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ateneva/70e3a6308293fa1d34787da7797f8c2f to your computer and use it in GitHub Desktop.
Save ateneva/70e3a6308293fa1d34787da7797f8c2f to your computer and use it in GitHub Desktop.
Fill empty cell with value from another column
Sub FillInEmptyCellWithAdjacent()
Dim Cell As Range
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'written by Angelina Teneva, September 2016
'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'copy to column
For Each Cell In ActiveSheet.Range("AB2:AB" & ActiveSheet.UsedRange.Rows.Count)
Cell.Activate
On Error Resume Next
If ActiveCell.Value <> 0 And Cells(ActiveCell.row, 25) = 0 Then ActiveCell.Copy Cells(ActiveCell.row, 25)
If IsEmpty(ActiveCell) Or ActiveCell.text = "" And Cells(ActiveCell.row, 44).text <> "#N/A" Then ActiveCell.Value = Cells(ActiveCell.row, 44)
Next Cell
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment