srobles escreveu: ↑Qua Nov 08, 2017 3:41 pm
Fabricio,
Devido á problemas de incompatibilidade entre sua versão e a minha do ListView, tive de adicionar a que tenho disponível aqui.
As únicas coisas diferentes que adicionei ao projeto foram o ListView e uma Function para retornar os dados, e, então na planilha Consignação, ao dar duplo-clique chama-se a Function, apenas isso.
Nos testes que realizei aqui, os dados são carregados corretamente. Vou verificar o porque de o mesmo não ocorrer contigo.
No exemplo que enviei, não se cria uma ListView nova para cada coluna. Criamos no ListView existente apenas as colunas da planilha (adicionadas dinamicamente em tempo de execução), porém não sei de qual planilha obter as colunas.
No ListView, teremos então todos os itens relacionados á maleta X, conforme imagem abaixo, correto?
exemplo.png
Quais colunas o ListView deve ter e de qual planilha?
Abs
Essas colunas...
With Me.lstvProdutos
.ListItems.Add 1, , UCase(Me.txtSku.Value)
.ListItems(1).ListSubItems.Add 1, , Me.txtNomeProduto
.ListItems(1).ListSubItems.Add 2, , Me.txtQuantidade.Value
.ListItems(1).ListSubItems.Add 3, , Format(Me.txtPrecoDeVendaSugerido, "Currency")
.ListItems(1).ListSubItems.Add 4, , Format(Me.txtSubTotalUnitario, "Currency")
.ListItems(1).ListSubItems.Add 5, , Format(Me.txtValorDesconto, "Currency")
.ListItems(1).ListSubItems.Add 6, , Format(Me.txtValorTotal, "Currency")
End With
Tenho uma dúvida amigo....não tem como carregar os dados igual a forma abaixo? Esse código eu uso para editar os dados de produtos...
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim i As Integer
i = Target.Row
'Carregar dados da tabela de Produtos 26
frmAlterarProdutos.txtSku.Value = Cells(i, 2).Value
frmAlterarProdutos.txtCodProduto.Value = Cells(i, 3).Value
frmAlterarProdutos.txtDataCadastro.Value = Cells(i, 4).Value
frmAlterarProdutos.cboGrupoCategoria.Value = Cells(i, 5).Value
frmAlterarProdutos.txtNomeProduto.Value = Cells(i, 6).Value
frmAlterarProdutos.cboTipoPeca.Value = Cells(i, 10).Value
frmAlterarProdutos.txtCodigoFabricante.Value = Cells(i, 11).Value
frmAlterarProdutos.cboFabricante.Value = Cells(i, 12).Value
frmAlterarProdutos.txtPeso.Value = Format(Cells(i, 13).Value, "0.00")
frmAlterarProdutos.txtNCM.Value = Cells(i, 18).Value
If Cells(i, 5).Value <> "Berloque" Then
frmAlterarProdutos.txtNCMDescricao = "Outras Bijuterias de Metais comuns, Prateado, Dourado ou Plaquê"
Else
frmAlterarProdutos.txtNCMDescricao = "Outras Bijuterias"
End If
frmAlterarProdutos.txtCustoUnitario.Value = Format(Cells(i, 19).Value, "R$ #,0.#0")
frmAlterarProdutos.txtCustoEmbalagem.Value = Format(Cells(i, 20).Value, "R$ #,0.#0")
frmAlterarProdutos.txtCustoFotografia.Value = Format(Cells(i, 21).Value, "R$ #,0.#0")
frmAlterarProdutos.txtCustoBanho.Value = Format(Cells(i, 22).Value, "R$ #,0.#0")
frmAlterarProdutos.txtCustoOutros.Value = Format(Cells(i, 23).Value, "R$ #,0.#0")
'frmAlterarProdutos.txtEstoqueMinimo.Value = Format(Cells(i, 26).Value, "0")
'frmAlterarProdutos.lblmedida.Caption = Cells(i, 27).Value
'frmAlterarProdutos.cboLocalizacaoEstoque.Value = Cells(i, 33).Value
frmAlterarProdutos.txtObs.Value = Cells(i, 34).Value
frmAlterarProdutos.txtQuantidadeTotalDisponivel.Value = Cells(i, 7).Value
frmAlterarProdutos.txtCustosDiretoTotal.Value = Format(Cells(i, 29).Value, "R$ #,0.#0")
frmAlterarProdutos.txtCustosDiretoTotal1.Value = Format(Cells(i, 29).Value, "R$ #,0.#0")
frmAlterarProdutos.txtPrecoDeVendaSugerido.Value = Format(Cells(i, 8).Value, "R$ #,0.#0")
frmAlterarProdutos.txtImposto.Value = Format(Application.WorksheetFunction.VLookup(frmAlterarProdutos.txtSku.Text, Sheets("Precificação").Range("Precificação"), 5, False), "0.00")
frmAlterarProdutos.txtCustoFixo.Value = Format(Application.WorksheetFunction.VLookup(frmAlterarProdutos.txtSku.Text, Sheets("Precificação").Range("Precificação"), 6, False), "0.00")
frmAlterarProdutos.txtSeguro.Value = Format(Application.WorksheetFunction.VLookup(frmAlterarProdutos.txtSku.Text, Sheets("Precificação").Range("Precificação"), 7, False), "0.00")
frmAlterarProdutos.txtComissao.Value = Format(Application.WorksheetFunction.VLookup(frmAlterarProdutos.txtSku.Text, Sheets("Precificação").Range("Precificação"), 8, False), "0.00")
frmAlterarProdutos.txtLucroDesejado.Value = Format(Application.WorksheetFunction.VLookup(frmAlterarProdutos.txtSku.Text, Sheets("Precificação").Range("Precificação"), 9, False), "0.00")
frmAlterarProdutos.txtIndiceComposicao.Value = Format(Application.WorksheetFunction.VLookup(frmAlterarProdutos.txtSku.Text, Sheets("Precificação").Range("Precificação"), 10, False), "0.00")
frmAlterarProdutos.txtMarkup.Value = Format(Application.WorksheetFunction.VLookup(frmAlterarProdutos.txtSku.Text, Sheets("Precificação").Range("Precificação"), 11, False), "0.00")
frmAlterarProdutos.Show
End Sub