Formatar celula com...
 
Notifications
Clear all

Formatar celula como porcentagem.

2 Posts
1 Usuários
0 Likes
1,153 Visualizações
(@robertonl)
Posts: 121
Estimable Member
Topic starter
 

Boa noite.
Estou tentando formatar a celula após salvar alteração, porém ela está sendo formatada como texto.
Como proceder neste caso.
As informações após alteradas precisa ficar no mesmo formato em que está a da segunda linha.
Segue link do arquivo e de imagem

Private Sub Btn_Altera_Click()
    'Call CentroCusto
    'Sub CentroCusto()
Dim linha

linha = 2

Do While PlanCentroCusto.Cells(linha, 2) <> ""

    If Lbl_LinhaCusto.Caption = PlanCentroCusto.Cells(linha, 2) Then
    
    ThisWorkbook.Worksheets("Centro de Custo").Cells(linha, 1) = CStr(Me.Id_Codigo.Caption)
    ThisWorkbook.Worksheets("Centro de Custo").Cells(linha, 2) = CStr(Me.Desc_CentroCusto.Text)
    ThisWorkbook.Worksheets("Centro de Custo").Cells(linha, 3) =Format((Me.Perc_CentroCusto.Value), "0.00%")
    'Me.Perc_CentroCusto.Value = Format((Me.Perc_CentroCusto.Value) / 100, "0.00%")
    ThisWorkbook.Worksheets("Centro de Custo").Cells(linha, 4) = CStr(Me.Cbo_Tipo.Value)
    ThisWorkbook.Worksheets("Centro de Custo").Cells(linha, 5) = CStr(Frm_CentroCusto.Obs_CentroCusto.Value)
    
    'Call Formata_Cadastro
    MsgBox "O registro atualizado com sucesso!"
    
     
     'CodigoCadastro = Empty
     'DescCompleta = Empty
     'DescResumida = Empty
     'Cbo_Classifica = Empty
     'ContaCorrente = Empty
     'BaseCalculoCadastro = Empty
     'Minimo = Empty
     'Maximo = Empty
     'Cbo_UnidMedida = Empty
     'Cbo_Status = Empty
     'QtdeEmbalagem = Empty
     'ReferenciaCadastro = Empty
     'LinhaCadastro.Caption = Empty
     
     'Me.Btn_Alterar.Enabled = False
     'Me.Btn_Novo.Enabled = False
    ' Me.Btn_Salvar.Enabled = False
     'Me.AbrePesquisa.Enabled = True
     'Me.DescCompleta.Enabled = False
     'Me.DescResumida.Enabled = False
     'Me.PesquisaCadastro.Enabled = False
     'Me.Cbo_UnidMedida.Enabled = False
     'Me.Cbo_Classifica.Enabled = False
     'Me.ContaCorrente.Enabled = False
     'Me.BaseCalculoCadastro.Enabled = False
     'Me.ReferenciaCadastro.Enabled = False
     'Me.QtdeEmbalagem.Enabled = False
     'Me.Minimo.Enabled = False
     'Me.Maximo.Enabled = False
     'Me.Cbo_Status.Enabled = False
     'Me.PesquisaCadastro.Enabled = False
    Exit Sub
    End If
    
    linha = linha + 1
    Loop
    
    'Call Classifica
    
    
    'Me.Txt_DescCusto = Empty
    'Me.Txt_ClassCusto = Empty
    'Me.Txt_Custo = Empty
    'Me.Txt_CalcCusto = Empty
    'Me.Lbl_Data = Empty
    'Me.Cmd_Alterar.Enabled = False
    'Me.Cmd_Novo.Enabled = True
    'Me.Cmd_Pesquisa.Enabled = True
    
    'End Sub
End Sub

Eis a configuração da listbox

Private Sub Lst_CentroCusto_Click()
 Dim carregar As Integer
carregar = Lst_CentroCusto.ListIndex
 
 Id_Codigo = Lst_CentroCusto.List(carregar, 0)
 Desc_CentroCusto = Lst_CentroCusto.List(carregar, 1)
 'Perc_CentroCusto = Format(CStr(Lst_CentroCusto.List(carregar, 2)), "0.00%")- Format((Me.Perc_CentroCusto.Value) / 100, "0.00%")
 Perc_CentroCusto = Format(Lst_CentroCusto.List(carregar, 2), "0.00%")
 'Worksheets("centro de custo").Columns("c").NumberFormat = "0.00%"
 Cbo_Tipo = Lst_CentroCusto.List(carregar, 3)
 Obs_CentroCusto = Lst_CentroCusto.List(carregar, 4)
 'Obs_CentroCusto = Lst_CentroCusto.List(carregar, 5)
 'EstMinimo = Lst_CorpoCadastro.List(carregar, 6)
 'UndMinimo = Lst_CorpoCadastro.List(carregar, 7)
 'EstMaximo = Lst_CorpoCadastro.List(carregar, 8)
 'UndMaximo = Lst_CorpoCadastro.List(carregar, 9)
 'Cbo_Status = Lst_CorpoCadastro.List(carregar, 10)
 'AtualizaCadastro = Lst_CorpoCadastro.List(carregar, 11)
 Lbl_LinhaCusto.Caption = Lst_CentroCusto.List(carregar, 1)
Lst_CentroCusto.Clear

    'Id_Codigo = Lst_CentroCusto.List(Lst_CentroCusto.ListIndex, 0)
    'Me.Lbl_LinhaCusto.Caption = Lst_CentroCusto.List(Lst_CentroCusto.ListIndex, 4)
    'Desc_CentroCusto = Lst_CentroCusto.List(Lst_CentroCusto.ListIndex, 1)
    'Perc_CentroCusto = Format(Lst_CentroCusto.List(Lst_CentroCusto.ListIndex, 2), "0.00%")
    'Cbo_Tipo = Lst_CentroCusto.List(Lst_CentroCusto.ListIndex, 3)
    'Obs_CentroCusto = Lst_CentroCusto.List(Lst_CentroCusto.ListIndex, 4)
    'Lbl_LinhaCusto.Caption = Lst_CentroCusto.List(Lst_CentroCusto.ListIndex, 5)
    Me.Desc_CentroCusto.Enabled = True
    Me.Perc_CentroCusto.Enabled = True
    Me.Cbo_Tipo.Enabled = True
    Me.Obs_CentroCusto.Enabled = True
    Me.Desc_CentroCusto.SetFocus
    'Me.Desc_CentroCusto.Enabled = True
    'Me.Perc_CentroCusto.Enabled = True
    'Me.Cbo_Tipo.Enabled = True
    'Me.Obs_CentroCusto.Enabled = True
    'Me.Desc_CentroCusto.SetFocus
    'Lst_CentroCusto.Clear
End Sub

https://www.sendspace.com/file/k9rh5x

[url]

https://www.sendspace.com/file/k9rh5x

https://www.sendspace.com/file/vph4sp
[/url]

 
Postado : 27/11/2019 11:26 pm
(@robertonl)
Posts: 121
Estimable Member
Topic starter
 

Boa tarde, encontrei a solução para a formatação necessária

 
Postado : 28/11/2019 10:44 am