Excel DDE macro examples
Finding the first empty cell in a column
Use an Excel VBA function to find where to append the next reading.
A common task when using WinWedge to feed data to an Excel spreadsheet using Dynamic Data Exchange (DDE) is to stack data received from WinWedge in a column in a worksheet where each new data reading is always stored at the bottom of a column in the worksheet. The problem is how to find the first empty cell at the bottom of a column in the most efficient way.
There are a number of ways to accomplish this however the most efficient way that we have found so far is using the technique in the following Excel VBA function. The following subroutine accepts either a sheet name (or the ordinal number for a sheet) and a column number as input variables and then returns the row number of the first empty cell at the bottom of the specified column.
Last modified on November 5, 2026