If a cell is empty, I want it to look in the cell above. If that one is empty, it will look in the cell above that until it finds a non-empty cell. When it does, it should return it. It'll be a UDF called loopUp
. Then, when I use it in a cell formula like so: =loopUp(D24)
, and the range D18:D24 is empty, it'll show what is in D17.
Here's some Psuedo:
Function loopUp(Cell)
while Cell is empty
Cell becomes cell above
return cell
I am new to VBA. The thing I am stuck on is how to pass in the address of a cell rather than its value.
I am stuck on is how to pass in the address of a cell rather than its value
Try like thisFunction loopUp(cl as range)
– Siddharth Rout