VBA - How to identify last active line, when has formula

0

The code below identifies the last active row of the worksheet.
When column A is populated manually it works. But when I put a formula to fill that column according to another worksheet. The code does not stop.

For example: the spreadsheet has data up to line 46, but execution only for when it arrives at line 78, as far as I've dragged the formula.

lUltimaLinhaAtiva = Worksheets("Painel").Cells(Worksheets("Painel").Rows.Count, 1).End(xlUp).Row
    
asked by anonymous 05.12.2018 / 14:53

1 answer

0

Considering a datasheet called "Data" and the with "Dashboard" formulas

Enter a% condition formula in the formula to leave the row empty if there is no data in the "Data" worksheet with:

=SE()

Where =SE(Dados!A1, FÓRMULA_CÁLCULO(A1), "") is the formula used for calculations in the "Dashboard" worksheet

Then the Last Line can be obtained with:

Dim lUltimaLinhaAtiva  As Long
lUltimaLinhaAtiva = Worksheets("Painel").Cells.Find("*", Cells(1, 1), xlValues, xlPart, xlByRows, xlPrevious, False, False).Row
    
06.12.2018 / 13:54