I would like to find the first non-empty cell (could be text or number) in a range within a row, say K5:AB5, where K5 through M5 might be empty cells and the first non-empty cell would be N5. This would span aboug 1000 rows and the first non-empty cell would occur anywhere from the first cell in the row to the almost the last cell in the row....different in each row.
I found code for finding the last empty cell within an entire row, but this is not for the entire row, but a portion of the row.......
Here is some code you can try. You can set the Start Column and End Column values in it, to define the range that you want to test for an empty cell. I created a variable 'firstempty' as an array and it stores the column number of the first empty cell in the array, tied to each row number as the index (e.g. firstempty(1) = column number of the first empty cell in row one)
I thought I was able to Dim a variable as an array, but apparently I was wrong, so I set it up as a Variant. If anyone knows what I might be doing wrong I'd appreciate the heads up.
Anyway, here's the code I put together:
Dim r, c As Integer
Dim firstempty(1 To 1000) As Variant
Dim LastRow, StartCol, EndCol As Integer