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.
#46101
Preciso executar a macro abaixo até o final da planilha onde vou incrementando somente as células C5 e F5 em uma linha ...( primeira rodada com c5 e f5, segunda com c6 e f6 , terceira com c7 e f7..até o fim da planilha ou seja não haja mais registros na coluna C....

Sub Macro9()

Range("C5").Select
Application.CutCopyMode = False
Selection.Copy
Range("C2").Select
ActiveSheet.Paste
Range("F2:O2").Select
Application.CutCopyMode = False
Selection.Copy
Range("F5").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
#46105
Olá, está meio difícil de entender, mas esse Script deve funcionar:
Código: Selecionar todos
Sub Copiar()
Dim UltimoRegistro As Integer
Application.ScreenUpdating = False

'Definir ultimo reg
If Cells.Range("C5").Value = Empty Then Exit Sub
UltimoRegistro = Cells.Range("C5").End(xlDown).Row

'Loop
For i = 5 To UltimoRegistro

    '   "transferir"
    Cells(i, 3).Copy
    Cells(i - 3, 3).PasteSpecial xlPasteAll
    
    Range("F" & i - 3 & ":O" & i - 3).Copy
    Cells(i, 6).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False

Next

Application.CutCopyMode = False
Range("A1").Select
Application.ScreenUpdating = True
End Sub
#46122
Boa Tarde eduardogrigull ... Não funcionou como esperado , tentei corrigir e não consegui, vou tentar ser mais claro...

A rotina é : copiar a celúla c5 e colar em c2 , ao fazer isto na Range f2:o2 ( que é fixa ) irá retornar valores de outra planilha que preciso copiar os valores e colar na célula F5. Vou fazer este processo de C5 até o último registro desta coluna C.

1 - copio C5 em C2, colo f2:o2 em f5
2 - copio c6 em c2, colo f2:o2 em f6
3- copio c7 em c2, colo f2:o2 em f7
4 - ..... idem até último registro
#46123
Código: Selecionar todos
Sub Teste()
 Dim i As Long
  For i = 5 To Cells(Rows.Count, 3).End(3).Row
   [C2] = Cells(i, 3)
   Cells(i, 6).Resize(, 10) = [F2:O2].Value
  Next i
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