Ir para conteúdo
Fórum Script Brasil

benzadeus

Membros
  • Total de itens

    84
  • Registro em

  • Última visita

Posts postados por benzadeus

  1. Sim, é normal.

    No entanto, tente usar:

    Sub Fazer()

    Application.ScreenUpdating = False

    With ThisWorkbook.Sheets("Plan1") '<- mude o nome para a Planilha desejada

    .Rows(2).Insert Shift:=xlDown

    .Rows(1).Copy

    .Rows(2).PasteSpecial xlPasteValues

    .Rows("31:31").Delete

    End With

    Application.ScreenUpdating = True

    End Sub

    O efeito de piscar será mais suave.

  2. A macro fica mais rápida se você armazenar todos os valores de linha numa variável e depois ocultá-las todas de uma vez:

    Sub OcultarRow_Col()
        Dim SomaColuna, ultimalinha, ultimacoluna, r, y As Integer
        Dim rng As Range
        Dim lng As Long
    
        Sheets("Diversos").Select
        ultimalinha = ActiveSheet.Range("V3")
        r = 0
        y = 0
        SomaColuna = 0
        ultimacoluna = 0
    
          Application.ScreenUpdating = False
          Application.Calculation = xlCalculationManual
        ' Oculta Linha
        Set rng = Rows(1) 'rng não pode ser Nothing inicalmente senão um erro é retornado
        For r = ultimalinha To 4 Step -1
            If Cells(r, 17) = 0 Then
                Set rng = Union(rng, Rows(r))
            End If
        Next r
        rng.Hidden = True
        
        Set rng = Rows(1) 'rng não pode ser Nothing inicalmente senão um erro é retornado
        For lng = 101 To 121
            If Cells(lng, 5) + Cells(lng, 6) + Cells(lng, 7) + Cells(lng, 8) = 0 Then
                Set rng = Union(rng, Rows(lng))
            End If
        Next lng
        rng.Hidden = True
    
        r = 0
        y = 0
        SomaColuna = 0
        ultimalinha = 0
        ultimacoluna = 16
        ' Oculta coluna
        For r = ultimacoluna To 1 Step -1
            'soma Positivos
            If Cells(98, r) = 0 And r <> 12 Then
                Columns(r).Hidden = True
            Else
                If r = 12 Then
                    SomaColuna = 0
                    For y = 4 To 95 Step 1
                        SomaColuna = SomaColuna + Abs(Cells(y, 12))
                    Next y
                    If SomaColuna = 0 Then
                        Columns(12).Hidden = True
                    End If
                End If
            End If
        Next r
        Application.ScreenUpdating = True
        Application.Calculation = xlCalculationAutomatic
    
    End Sub

  3. Sub Exemplo()

    Dim dNúmeroPeríodos As Double

    Dim dValorPresente As Double

    Dim dTaxa As Double

    Dim dValorParcelas As Double

    dTaxa = 0.015

    dNúmeroPeríodos = 3

    dValorPresente = 800

    dValorParcelas = VBA.Pmt(dTaxa, dNúmeroPeríodos, -dValorPresente)

    MsgBox dValorParcelas

    End Sub

  4. Sub Exemplo()

    Dim rng As Range

    Dim sPrimeiro As String

    Dim sBusca As String

    Dim rBanco As Range

    sBusca = "Benzadeus"

    Set rBanco = Cells 'Toda Planilha

    Set rng = rBanco.Find(What:=sBusca _

    , LookIn:=xlValues _

    , LookAt:=xlPart _

    , MatchCase:=False)

    If Not rng Is Nothing Then

    sPrimeiro = rng.Address

    Do

    MsgBox "'" & sBusca & "' encontrado na célula " & rng.Address(0, 0) & "'."

    Set rng = rBanco.FindNext(rng)

    Loop While Not rng Is Nothing And rng.Address <> sPrimeiro

    Else

    MsgBox "Nenhuma ocorrência de '" & sBusca & "' encontrada."

    End If

    End Sub

  5. Olá,

    Tente usar:

    Sub Teste()

    Application.EnableEvents = False

    ActiveCell.Range("A1:AM1").Copy Destination:=Sheets("resolvidas").Range("A3").Select

    Sheets("resolvidas").Unprotect "12312"

    Sheets("resolvidas").End(xlDown).Offset(1, 0).Paste

    ActiveCell.Range("S1:AM1").ClearContents

    Sheets("resolvidas").Protect "12312"

    Application.EnableEvents = True

    End Sub

  6. Não tenho como testar, mas experimente trocar

    ActiveChart.SetSourceData Source:=Sheets("Plan2").Range(Cells(X, 58), Cells(y, 54)).Select, _
    PlotBy:=xlColumnsActiveChart.Location Where:=xlLocationAsObject, Name:="Plan1"
    por
    ActiveChart.SetSourceData Source:=Sheets("Plan2").Range(Cells(X, 58), Cells(y, 54)), _
    PlotBy:=xlColumnsActiveChart.Location Where:=xlLocationAsObject, Name:="Plan1"

×
×
  • Criar Novo...