Re-transferir dados da listbox para planilha

wasbarreto

New Member
Joined
Jun 4, 2021
Messages
1
Office Version
  1. 2019
  2. 2013
Platform
  1. Windows
Olá, tenho uma planilha que contém vários dados, estou puxando esses dados por meio de uma listbox. Nesta listbox tenho duas textbox para pesquisa de cliente e produto. Tenho uma função para ao das dois clics em determinada linha da listbox, me retorne os dados em um novo userform com uma das textbox editáveis para alterar ou não os dados. essa alteração está sendo enviada à listbox, porém não surte efeito na planilha de origem. Gostaria de ajuda.

Aqui está o código da minhs listbox:

Private Sub UserForm_Initialize ()
With Worksheets ("SACARIA IMPRESSA")
ListBox1.Clear
ListBox1.ColumnCount = 7
ListBox1.ColumnWidths = "280; 280; 50; 50; 50; 50; 50"

Dim linha como inteiro

Dim sht como planilha

Dim LastRow As Long

Set sht = ThisWorkbook.Worksheets ("SACARIA IMPRESSA")

LastRow = sht.ListObjects ("Tabela1"). Range.Rows.Count

For linha = 5 To LastRow

ListBox1.AddItem Worksheets ("SACARIA IMPRESSA"). Range (" B "& linha)
ListBox1.List (ListBox1.ListCount - 1, 1) = Planilhas (" SACARIA IMPRESSA "). Intervalo (" C "e linha)
ListBox1.List (ListBox1.ListCount - 1, 2) = Planilhas (" SACARIA IMPRESSA "). Faixa (" D "elinha)
ListBox1.List (ListBox1.ListCount - 1, 2) = VBA.Format (ListBox1.List (ListBox1.ListCount - 1, 2), "0,00")
ListBox1.List (ListBox1.ListCount - 1, 3) = Planilhas ("SACARIA IMPRESSA"). Range ("E" & linha)
ListBox1.List (ListBox1.ListCount - 1, 3) = VBA.Format (ListBox1.List (ListBox1.ListCount - 1, 3), "0,00" )
ListBox1.List (ListBox1.ListCount - 1, 4) = Planilhas ("SACARIA IMPRESSA"). Range ("F" & linha)
ListBox1.List (ListBox1.ListCount - 1, 4) = VBA.Format (ListBox1.List (ListBox1.ListCount - 1, 4), "0,00")
ListBox1.List (ListBox1.ListCount - 1, 5) = Planilhas ("SACARIA IMPRESSA"). Intervalo ("G" & linha)
ListBox1.List (ListBox1 .ListCount - 1, 5) = VBA.Format (ListBox1.List (ListBox1.ListCount - 1, 5),"00")
ListBox1.List (ListBox1.ListCount - 1, 6) = Planilhas ("SACARIA IMPRESSA"). Intervalo ("H" & linha)
Próximas
planilhas ("SACARIA IMPRESSA"). Intervalo ("H" & linha) = ListBox1.List (ListBox1.ListCount - 1, 6)

End With

End Sub





-------



Esses são do meu botão do userform que recebe os dados para edição:

Private Sub CommandButton2_Click ()
UserForm5.ListBox1.Column (6) = UserForm6.TextBox5.Text

Unload Me
End Sub



-----



porém gostaria que no momento em que um listbox receba o valor do textbox, também altere os valores da planilha, mas isso não está acontecendo.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,214,606
Messages
6,120,484
Members
448,967
Latest member
visheshkotha

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top