A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
It's a small matter to change that macro so that it uses a formula to reference the last cell in column H within the data block.
Sub mcr_BottomH_to_TopE()
Dim rw As Long
If Selection.Column <> 5 Then
MsgBox "Select the top value in column E to start."
Exit Sub
End If
rw = Selection.Row
Do While rw < ActiveSheet.UsedRange.Rows.Count
Cells(rw, 5).Formula = Chr(61) & Cells(rw + 1, 8).End(xlDown).Address
rw = Cells(rw + 1, 8).End(xlDown).Offset(1, -3).End(xlDown).Row
Loop
End Sub
Chr(61) is just a fancy way of describing an equals sign (i.e. ASCII 0×061). .Address by default returns the cell's absolute address like $H$1. If you prefer a relative address (e.g. H1) then change that to .Address(0,0).