
Given the image ... If I know that there is some data starting with a range ("B3").
How can I find cells with adjacent data before cell E3? Since F3 is empty, G3 should not be considered further. The result can be either a range object (B3: E3) or the number of cells (in this case 4).
By setting B3 as the active cell and making ..
Range(ActiveCell, ActiveCell.End(xlToRight).Count
I get an invoice, however this method is not reliable, if only B3 has data, it counts the cells to the end of the sheet.
Of course, this can also be achieved by cycling through the cells, but I would prefer to use the worksheet function or some other efficient method.
source
share