Jump to content
Fórum Script Brasil



Tenho um arquivo com duas planilhas ("Planilha1" e "Planinha2").

Na planilha1, tem uma tabela "A1:O2" (2 linhas, 14 colunas), sendo a primeira linha o cabeçalho.

Estou tentando inserir um código que atualize o valor de cada célula da linha 2 com um procv com base no valor inserido na célula imediatamente anterior a ela, porém está gerando erro.
O procv busca o valor na planilha2 

Segue código:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim i, j As Integer
Dim TabelaFonte As Range

i = Target.Column
j = 3
TabelaFonte = Application.Sheets("Planilha4").Range(Cells(3, 119 + j - 1), Cells(2649, 148))

If Not Intersect(Target, Range("B2:O2")) Is Nothing Then
    For j = i + 1 To 14
    Cells(2, j).Value = Application.WorksheetFunction.VLookup(Cells(2, j - 1).Value, TabelaFonte, 2, False)

End If

End Sub


O link do arquivo é o:



Share this post

Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Forum Statistics

    • Total Topics
    • Total Posts
  • Create New...