Jump to content

Recommended Posts

Posted

Boa noite,

Como entendo pouco de vba gostaria de por aqui duas questões, como posso substituir

rng.EntireRow.Copy

por um range tipo A2:cxxxx para que o código abaixo funcionasse?

E como é que possso substituir

If rng Like "*not*" Then

ligar este código a uma célula sem ter de escrever os asteriscos antes e depois de ecrever uma palavra?

desde já obrigado.

Sub CopyRows()
Application.ScreenUpdating = False
Dim bottomA As Integer
bottomA = Sheets("Folha1").Range("A" & Rows.Count).End(xlUp).Row
Dim rng As Range
For Each rng In Sheets("Folha1").Range("a2:A" & bottomA)
 If rng Like "*not*" Then
	 rng.EntireRow.Copy Sheets("Folha2").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0)
 End If
Next rng
Application.ScreenUpdating = True
End Sub
Posted (edited)

Boas,

tentei mudar o

rng.EntireRow.Copy

para

rng.Folha1.Range("A2:C1000").Copy

mas dá sempre erro, nao sei onde estou a errar,este código

rng.EntireRow.Copy

copia-me as linhas e eu queria que me copiasse da coluna A:C

Edited by sagostinho
  • 2 weeks later...
  • 1 month later...
Posted (edited)

rng.Folha1.Range("A2:C1000").Copy

mas dá sempre erro, nao sei onde estou a errar,este código

Experimentaste:

rng.Sheets("Folha1").Range("A2:C1000").Copy

Edited by manuel antonio

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.