Notifications
Clear all

PROCV atraves do VBA

4 Posts
2 Usuários
0 Reactions
1,799 Visualizações
(@fernandofernandes)
Posts: 43750
Illustrious Member
Topic starter
 

Boa tarde a todos;
Preciso inserir um procv em uma planilha mas não estou conseguindo o código é este

x = .Range("A65536").End(xlUp).Row + 1
.Cells(x, 2).Select
nomePlan = "'" & nomePlan & "'"
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:=nomePlan & "!A1", _
TextToDisplay:=nomePlan
Celu = Cells(x - 1, 1).Value + 1
.Cells(x, 1).Value = Cells(x - 1, 1).Value + 1
.Cells(x, 3).Value = txtDispositivo.Value
.Cells(x, 4).Value = txtExecutor.Value
.Cells(x, 5).Value = txtAlimentador.Value
.Cells(x, 6).Value = txtCidade.Value
.Cells(x, 7).Value = "=" & nomePlan & "!" & "$F$69"
.Cells(x, 8).Value = "=" & nomePlan & "!" & "$K$90"
até aqui blz
mas não consigo inserir esse procv
.Cells(x, 9).Value = "=PROCV(A" & Celu & ";RSE!A8;B35;2;2)"
Dá erro em tempo de execução '1004:
ERRO DE DEFINIÇÃO DE APLICATIVO OU DE DEFINIÇÃO DE OBJETO

qual a maneira correta? a coluna procurada é A a linha é variavel (Celu) ; mas tentei assim "=PROCV(A15;RSE!A8;B35;2;2)" e tambem deu o mesmo erro

 
Postado : 28/02/2012 11:36 am
(@fernandofernandes)
Posts: 43750
Illustrious Member
Topic starter
 

Boa tarde,

Veja se funciona assim:

.Cells(x, 9).FormulaLocal = "=PROCV(A" & Celu & ";RSE!A8:B35;2;2)"

Abraço

 
Postado : 28/02/2012 12:01 pm
(@m_araujo)
Posts: 159
Estimable Member
 

Boa tarde, veja se lhe atende essa função que meu amigo alexandreVBA me passou

On Error Resume Next
If TxtUmidadeEntrada.Value = "" Then
MsgBox "Entre com o valor.", "Verifique", vbCritical
TxtUmidadeEntrada.SetFocus
End If
TxtUmidadeEntrada.Value = FormatNumber(TxtUmidadeEntrada.Value, 2)
Umidade.Text = FormatNumber(Umidade.Value, 2)
Umidade.Value = Application.VLookup(CDbl(TxtUmidadeEntrada.Value), Plan7.Range("A2:B306"), 2, 0) / Aqui eel busca o valor respectivo digitado no textbox

 
Postado : 28/02/2012 12:18 pm
(@fernandofernandes)
Posts: 43750
Illustrious Member
Topic starter
 

muitissimo obrigado ; na mosca a resposta do JValq a do m_araujo vou testar4 pra ver como funciona

 
Postado : 28/02/2012 12:27 pm