Propósito

✔ Programação GLOBAL® - Quaisquer soluções e/ou desenvolvimento de aplicações pessoais, ou da empresa, que não constem neste Blog devem ser tratados como consultoria freelance. Queiram contatar-nos: brazilsalesforceeffectiveness@gmail.com | ESTE BLOG NÃO SE RESPONSABILIZA POR QUAISQUER DANOS PROVENIENTES DO USO DOS CÓDIGOS AQUI POSTADOS EM APLICAÇÕES PESSOAIS OU DE TERCEIROS.

.: Vitrine

Carregando artigos...

Views

Mostrando postagens com marcador value. Mostrar todas as postagens
Mostrando postagens com marcador value. Mostrar todas as postagens

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

Sub FindFormulaSheets()

    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

VBA Excel - Obtenha o valor de um Range fazendo Looping entre as Abas - Loop Through Sheets and get Value from a range

Sub LoopThroughSheetsGetValue()

    Dim ws As Worksheet
    Worksheets("Total").Range("A2:B100").ClearContents

    For Each ws In ActiveWorkbook.Worksheets
        If ws.Name <> ("Total") Then

            If ws.Visible = True Then
                Let Range("A65536").End(xlUp).Offset(1, 0) = ws.Name
                Let Range("A65536").End(xlUp).Offset(0, 1) = _
                Format(ws.Range("D8"), "h:mm;@")    'Tota da Horas

            End If
        End If
    Next ws
    
End Sub

Tags: Excel, VBA, Loop, Sheets, get, range, value, 


Inline image 1

VBA Excel - Procurando um valor na Coluna A com Looping - Find a Value in Column A using a loop

Sub FindValue()

'This example Loops through Column"A", and searches for
'a value selected from the input box and diplays the address with a MsgBox

    Dim r As Range
    Dim c As Range
    Dim s As String
    Dim ms As String

    Set r = Range("A1", Range("A65536").End(xlUp))

    Let ms = "The Value was found at  "
    Let s = InputBox("Enter Value to Find", "Hello", "Enter Number Here")

    For Each c In r.Cells
        If c = s Then MsgBox ms & c.Address
    Next c

End Sub

Tags: Excel, VBA, Find, Value, Column, loop, Range.  



Inline image 1

VBA Excel Basic - Como acessar o valor de um Range mostrando-o num Message Box - How To Access The Excel Range And Show The Value Using Message Box




É importante deixar alguns tópicos neste Blog, que sejam voltados para quem está iniciando na utilização do VBA - Visual Basic for Application.


Sub sbExample1()
    'Isso mostrará o valor da célula A5 no message Box
    MsgBox Range("A5")
    'Use o objeto Cell Object fazendo referência a A5 conforme mostrado abaixo:
     MsgBox Cells(5, 1) 'Aqui 5 é o número da Linha e 1 o número da Coluna
End Sub

TagsVBA, Basic, Excel, worskheet, Sheet, aba, Planilha, Range, Show, Value, Message Box,


VBA Excel - Colorindo toda uma linha a partir de um parâmetro numa coluna - Color Entirerow based on a column's value

Blog Office VBA | Blog Excel | Blog Access |
Inline image 2

Depois de termos preenchido uma certa área com resultados processados, ou termos conectado nossa planilha em uma base de dados, podemos propiciar que esta área seja destaca pela aplicação da funcionalidade abaixo.

A partir de um parâmetro qualquer (neste caso na coluna P), podemos definir o destaque de toda uma Linha.



Private Sub Worksheet_Change(ByVal Target As Range)
'Error Handling
On Error Resume Next
    'Check only, if the change happens in Column P.
    If Left(Target.Address(0, 0), 1) = "P" Then
        'Check if selected value changed to Active
        If UCase(Target.Value) = "ACTIVE" Then
            'If Active is selected in drop down list,
            'Row color will change to green.
            Target.EntireRow.Font.Color = RGB(0, 102, 0)
            
        'Check if selected value changed to Deactive
        ElseIf UCase(Target.Value) = "DEACTIVE" Then
            'If Deactive is selected in drop down list,
            'Row color will change to red.
            Target.EntireRow.Font.Color = vbRed
            
        'Check if it's something else than Active or Deactive
        '(Not possible but have been put for validation sake.
        Else
            Target.EntireRow.Font.Color = vbBlack
        End If
    End If
'Turn off Error Handling
On Error GoTo 0
End Sub

Reference:
Tags: VBA, Excel, entirerow, color, column, value, Data Validation, Event Macro, Queries and Solutions


diHITT - Notícias