Página 1 de 1

Tentando atualizar informações por meio de formulario

Enviado: 23 Jun 2019 às 17:57
por alexcuritiba
to tentando atualizar informações no formulario com o seguinte comando:
Private Sub edit_cad_Click()
Worksheets("BASE").Select
x = cad_localizarcx.ListIndex + 3

Cells(x, 1) = cad_1
Cells(x, 2) = cad_2
Cells(x, 3) = cad_3
Cells(x, 4) = cad_4
Cells(x, 5) = cad_5
Cells(x, 6) = cad_6
Cells(x, 7) = cad_7
Cells(x, 8) = cad_8
Cells(x, 9) = cad_9
Cells(x, 10) = cad_10
Cells(x, 11) = cad_11
Cells(x, 12) = cad_12
Cells(x, 13) = cad_13
Cells(x, 14) = cad_14
Cells(x, 16) = cad_16

End sub

mais na planilha ele vai até o cad_7 re torna para situação abaixo sem atualizar os campos e deixando com os anteriores
Private Sub cad_localizarcx_Click()
Worksheets("BASE").Select
totlin = Worksheets("BASE").UsedRange.Rows.Count + 1
For i = 0 To totlin
If cad_localizarcx.ListIndex = i Then
cad_1= Cells(i + 3, 1)
cad_2 = Cells(i + 3, 2)
cad_3 = Cells(i + 3, 3)
cad_4 = Cells(i + 3, 4)
cad_5 = Cells(i + 3, 5)
cad_6 = Cells(i + 3, 6)
cad_7= Cells(i + 3, 7)
cad_8 = Cells(i + 3, 8)
cad_9 = Cells(i + 3, 9)
cad_10= Cells(i + 3, 10)
cad_11 = Cells(i + 3, 11)
cad_12 = Cells(i + 3, 12)
cad_13 = Cells(i + 3, 13)
cad_14 = Cells(i + 3, 14)
cad_16 = Cells(i + 3, 16)

End If
Next
End Sub