Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Tópicos relacionados a códigos VBA, gravação de macros, etc.
Por Diego100ges
Posts
#48335
Boa tarde pessoal!
Estou com uma planilha aqui, que fazem alguns cálculos e no final geram 3 resultados, onde preciso apenas de 2, como é uma análise feita para várias lojas, gostaria de uma macro, para copiar o nome da loja, o resultado da demanda contratada, e o resultado da demanda simulada, e gravasse esses 3 valores em uma outra aba.
Poderiam dar uma força?

Muito obrigado.
Segue anexo.
Você não está autorizado a ver ou baixar esse anexo.
Por Diego100ges
Posts
#48342
Pessoal, acabei conseguindo fazer aqui, mas acredito que o código não tenha a melhor performance então caso alguém acredite que é possível melhorar ele, estou utilizando assim:
Código: Selecionar todos
Sub teste()
Application.ScreenUpdating = False
Sheets("Estudo demanda").Select
    Range("M33").Select
    Selection.Copy
    Sheets("TESTE").Select
    Range("A2").Select
    Do
        If ActiveCell <> "" Then
        ActiveCell.Offset(1, 0).Select
        End If
    Loop Until ActiveCell = ""
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    
Sheets("Estudo demanda").Select
    Range("e60").Select
    Selection.Copy
    Sheets("TESTE").Select
    Range("B2").Select
    Do
        If ActiveCell <> "" Then
        ActiveCell.Offset(1, 0).Select
        End If
    Loop Until ActiveCell = ""
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
        
Sheets("Estudo demanda").Select
    Range("k60").Select
    Selection.Copy
    Sheets("TESTE").Select
    Range("C2").Select
    Do
        If ActiveCell <> "" Then
        ActiveCell.Offset(1, 0).Select
        End If
    Loop Until ActiveCell = ""
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    

End Sub
Por osvaldomp
#48344
Código: Selecionar todos
Sub ReplicaDados()
 Dim rng As Range, i As Long
  For Each rng In Sheets("Estudo demanda").Range("M33,E60,K60")
   Sheets("TESTE").Cells(Rows.Count, i + 1).End(3)(2) = rng.Value: i = i + 1
  Next rng
End Sub
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord