If Cell "H1" is a header then you should be able to use the following code. I inserted this code into the worksheet "Sheet2". Hope that works out for you.
Private Sub Worksheet_Change(ByVal Target As Range) 'If there are any changes in THIS worksheet the macro will run
Application.ScreenUpdating = False 'Disables screen updating
ActiveWorkbook.Sheets("Sheet2").Activate ' Activates Sheet2
Columns("H:H").AutoFilter Field:=1, Criteria1:="<>" 'Filters Column H to Non-Blanks
Sheets("Sheet1").Range("D:D").ClearContents 'Clears Column D in Sheet1
Range("H:H").Copy 'Copies Column H non-blank cells
Sheets("Sheet1").Range("D1").PasteSpecial 'Pastes non-blanks into Sheet1 Column D starting in Cell D1
Sheets("Sheet2").Columns("H:H").AutoFilter 'Clears the AutoFilter
Application.ScreenUpdating = True 'Enables screen updating
End Sub
Originally Posted by Tom
Bookmarks