Ir ao conteúdo
  • Cadastre-se

Copiar e colar em outra planilha resultado da pesquisa.


valdecirr

Posts recomendados

Bom dia

Após fazer um pequisa, segue a linha de comando, como faço para copiar e colar o resultado em outra planilha?

Esta é a linha de comando para colar em outra planilha que coloquei em um botão, mas não da certo..

Resultado.Select

Selection.Copy

Sheets("Plan2").Select

Range("A:C").Select

ActiveSheet.Paste

____________________________________________________________________________

Private Sub Procura_emp(ByVal Termo As String)

Dim Busca As Range

Dim Primeira As String

Dim Resultado As String

Set Busca = Sheets("Geral").Cells.Find(What:=Termo, After:=Sheets("Geral").Range("C2"), LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False, SearchFormat:=False)

If Not Busca Is Nothing Then

Primeira = Busca.Address

Resultado = Busca.Row

Do

Set Busca = Sheets("Geral").Cells.FindNext(After:=Busca)

If Not Busca.Address Like Primeira Then

Resultado = Resultado & ";" & Busca.Row

End If

Loop Until Busca.Address Like Primeira

MatrizResultado = Split(Resultado, ";")

SpinButton1.Max = UBound(MatrizResultado)

SpinButton1.Enabled = True

lbl_contador.Caption = " 1 de " & UBound(MatrizResultado) + 1

lblCod.Caption = Sheets("Geral").Cells(MatrizResultado(0), 1).Value

cboAtivo.Text = Sheets("Geral").Cells(MatrizResultado(0), 2).Value

cboCadastro.Text = Sheets("Geral").Cells(MatrizResultado(0), 3).Value

cbonome.Text = Sheets("Geral").Cells(MatrizResultado(0), 4).Value

cboEmpresa.Text = Sheets("Geral").Cells(MatrizResultado(0), 5).Value

cboControlador.Text = Sheets("Geral").Cells(MatrizResultado(0), 6).Value

cbodtaso.Text = Sheets("Geral").Cells(MatrizResultado(0), 7).Value

cbodataintegracao.Text = Sheets("Geral").Cells(MatrizResultado(0), 10).Value

TxtEntrada.Text = Sheets("Geral").Cells(MatrizResultado(0), 13).Value

cboCS.Text = Sheets("Geral").Cells(MatrizResultado(0), 14).Value

cboFR.Text = Sheets("Geral").Cells(MatrizResultado(0), 15).Value

cboEPI.Text = Sheets("Geral").Cells(MatrizResultado(0), 16).Value

cboNR10.Text = Sheets("Geral").Cells(MatrizResultado(0), 17).Value

TxtDataNR10.Text = Sheets("Geral").Cells(MatrizResultado(0), 18).Value

cboCT.Text = Sheets("Geral").Cells(MatrizResultado(0), 19).Value

cboNR35.Text = Sheets("Geral").Cells(MatrizResultado(0), 20).Value

cboNR35Aso.Text = Sheets("Geral").Cells(MatrizResultado(0), 21).Value

TxtDataNR35.Text = Sheets("Geral").Cells(MatrizResultado(0), 22).Value

cboNR33.Text = Sheets("Geral").Cells(MatrizResultado(0), 23).Value

TxtDataNr33.Text = Sheets("Geral").Cells(MatrizResultado(0), 24).Value

cboNR18.Text = Sheets("Geral").Cells(MatrizResultado(0), 25).Value

TxtDataNr18.Text = Sheets("Geral").Cells(MatrizResultado(0), 26).Value

txtOBS.Text = Sheets("Geral").Cells(MatrizResultado(0), 27).Value

Else

SpinButton1.Enabled = False

lbl_contador.Caption = ""

lblCod.Caption = ""

cboAtivo.Text = ""

cboCadastro.Text = ""

cbonome.Text = ""

cboEmpresa.Text = ""

cboControlador.Text = ""

cbodtaso.Text = ""

cbodataintegracao.Text = ""

TxtEntrada.Text = ""

cboCS.Text = ""

cboFR.Text = ""

cboEPI.Text = ""

cboNR10.Text = ""

TxtDataNR10.Text = ""

cboCT.Text = ""

cboNR35.Text = ""

cboNR35Aso.Text = ""

TxtDataNR35.Text = ""

cboNR33.Text = ""

TxtDataNr33.Text = ""

cboNR18.Text = ""

TxtDataNr18.Text = ""

txtOBS.Text = ""

MsgBox "Nenhum resultado para '" & Termo & "' foi encontraro."

End If

End Sub

Link para o comentário
Compartilhar em outros sites

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...

 

GRÁTIS: ebook Redes Wi-Fi – 2ª Edição

EBOOK GRÁTIS!

CLIQUE AQUI E BAIXE AGORA MESMO!