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 Domingsp
Posts
#28247
Boa tarde, Tenho o seguinte código que copia dados da coluna "S", da plan10, para "E" ,na plan2.
Só que a faixa a ser copiada de "S" será variavel a cada execução. Tipo S1:S5, depois será S5:S30, S33:S40...
Esses indices das linhas de "S" eu entraria através de inputbox.
Eu não sei como variar essa referencia da Range a ser copiada.
Código: Selecionar todos
 Sub COPIAR()
Application.ScreenUpdating = False
   Sheets("Plan10").Select
    Range("S1:S100").Select
    ActiveWindow.SmallScroll Down:=-27
    Application.CutCopyMode = False
    Selection.Copy
    Sheets("Plan2").Select
    Range("E1").Select
    ActiveSheet.Paste
Application.ScreenUpdating = True
End Sub
Por osvaldomp
#28253
Código: Selecionar todos
Sub ReplicaDados()
 Dim a As String
  a = Application.InputBox("INSIRA O NÚMERO DA LINHA INICIAL E O NÚMERO" & vbLf _
   & "DA LINHA FINAL NO FORMATO XXXX" & vbLf & "exemplo: 0520 para copiar da linha 5 até a 20")
  On Error Resume Next
  Range("S" & Left(a, 2) & ":S" & Right(a, 2)).Copy Sheets("Plan2").[E1]
End Sub
opção sem InputBox ~~~> selecione o intervalo a replicar e rode o código
Código: Selecionar todos
Sub ReplicaDadosV2()
 Selection.Copy Sheets("Plan2").[E1]
End Sub
Por babdallas
#28254
Segue minha contribuição
Código: Selecionar todos
Sub COPIAR()
    Dim vrtLinhaIni As Variant, vrtLinhaFim As Variant
    
    Do
        vrtLinhaIni = Application.InputBox("Digite um número para a linha inicial", "LINHA INICIAL")
    Loop While Not IsNumeric(vrtLinhaIni)
    
    Do
        vrtLinhaFim = Application.InputBox("Digite um número para a linha final", "LINHA FINAL")
    Loop While Not IsNumeric(vrtLinhaFim)
    
    Sheets("Plan2").Range("E1:E" & vrtLinhaFim - vrtLinhaIni + 1).Value = _
        Sheets("Plan10").Range("S" & vrtLinhaIni & ":S" & vrtLinhaFim).Value
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