Excel Cell with VBA

Asked

Viewed 71 times

-1

Hello,

I’m trying to finish an excel spreadsheet with VBA, but I’m not able to capture an image after data insertion. For example: click user and he show the photo of the person and also the full name. follows below what I have done.

    Private Sub TxtUsuario_Change()
       Dim Imagem

       ultimaLinha = Plan16.Cells(Plan16.Cells.Rows.Count, "a").End(xlUp).Row

        For f = 2 To ultimaLinha
        If Cells(f, 1) = TxtUsuario Then
        TxtNome = Cells(f, 4)

        End If
        Next

        End Sub

    Private Sub UserForm_Initialize()
        linha = 2
        Do Until Plan16.Cells(linha, 1) = ""
        TxtUsuario.AddItem Plan16.Cells(linha, 1)
        linha = linha + 1
        TxtUsuario.SetFocus
        Loop
        Call removeCaption(Me)

        For f = 2 To ultimaLinha
        If Cells(f, 1) = TxtUsuario Then
        TxtNome = Cells(f, 4)

        End If
        Next

        TxtUsuario.SetFocus

        Call removeCaption(Me)
        End Sub 

1 answer

0

Hello,

While observing your code, I realize that it is missing to declare the guy of the local variable "Imagery". Even if you don’t use it, you might want to declare.

Another thing, you are only saving the address of the image in the spreadsheet, right?! If not, try to do it that way. Through the address, initialize the instruction Excel must search directly from the folder where the image is allocated.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.