Views

Histats

Vitrine

VBA Excel - Recupere um Valor a partir de uma Fórmula em cada Aba - Get a value from a formula in each sheet

Sub Sub FindFormulaSheets()
you don't want it formatted
    Dim sh As Worksheet
    Dim f As Range
    Dim s
    
    Worksheets("Total").Range("A2:B100").ClearContents

    Application.ScreenUpdating = False
    Let s = "=SUM(D2:D6)"

    For Each sh In ActiveWorkbook.Worksheets
        If sh.Name <> ("Total") Then
            Set f = sh.Cells.Find(s, LookIn:=xlFormulas)
            If Not f Is Nothing Then
             Range("A65536").End(xlUp).Offset(1, 0) = sh.Name
                Worksheets("Total").Range("A65536").End(xlUp).Offset(0, 1) = Format(f, "h:mm;@")
                Let Application.ScreenUpdating = True
            End If
        End If
    Next sh

    Worksheets("Total").Activate

End Sub


Tags: Excel, VBA, Loop, Sheets, recupere, valor, fórmula, Aba, get, value, ,formula, sheet, 


Inline image 1

LinkWithinBrazilVBAExcelSpecialist

Related Posts Plugin for WordPress, Blogger...