Formulário não carr...
 
Notifications
Clear all

Formulário não carrega coluna

11 Posts
2 Usuários
0 Reactions
2,828 Visualizações
(@rui-maciel)
Posts: 0
New Member
Topic starter
 

Boa noite caros
Tenho o seguinte problema na meu ficheiro, no formulário "frmPagamentoConsolidado" não apresenta a última coluna referente ao mês de dezembro, pois, o que faz é subtrair as colunas de 15 a 26 às colunas 3 a 14 e apresentar o resultado na listview1, contudo, quando inicia o formulário só apresenta três linhas da coluna referente a dezembro, e se selecionar um nome na textbox apresenta só a primeira linha, podem ajudar-me? Obrigado desde já.
Rui Maciel

 
Postado : 14/04/2020 4:09 pm
(@anderson)
Posts: 0
New Member
 

.

 
Postado : 14/04/2020 4:29 pm
(@rui-maciel)
Posts: 0
New Member
Topic starter
 

Obrigado Sr. Anderson
Muito bom, funciona e percebi o problema, no entanto, quando mando imprimir a listagem a última coluna ("O") do mês de dezembro não vai como número e por isso não faz a soma total, pode ajudar-me com uma solução?
Grato
Rui Maciel

 
Postado : 14/04/2020 4:49 pm
(@anderson)
Posts: 0
New Member
 

.

 
Postado : 14/04/2020 4:58 pm
(@rui-maciel)
Posts: 0
New Member
Topic starter
 

Boa noite Sr. Anderson e obrigado.
Inseri uma textbox "txtSoma" no userform "frmpendenteconsolidado", quando inicia o userform a soma total aparece, contudo, quando seleciono na "txtCliente" o cliente a soma não aparece e dá o erro 424, pode ajudar-me? Obrigado.
Abraço,
Rui Maciel

 
Postado : 15/04/2020 1:57 pm
(@anderson)
Posts: 0
New Member
 

.

 
Postado : 15/04/2020 2:05 pm
(@rui-maciel)
Posts: 0
New Member
Topic starter
 

Obrigado
Tem um problema está sempre a somar em cima do valor anterior, tem como resolver?

 
Postado : 15/04/2020 2:32 pm
(@anderson)
Posts: 0
New Member
 

.

 
Postado : 15/04/2020 2:37 pm
(@anderson)
Posts: 0
New Member
 

.

 
Postado : 15/04/2020 3:39 pm
(@rui-maciel)
Posts: 0
New Member
Topic starter
 

Quando entra o valor aparece correto 10.800 €, quando seleciono o cliente album deveria aparecer 2.640,00 € e não aparece e quando apago o cliente da textbox deveria aparecer 10.800,00 € e não aparece. Tem remédio? Obrigado pela paciência.

 
Postado : 15/04/2020 3:53 pm
(@anderson)
Posts: 0
New Member
 
Private Sub cmdImprimir_Click()
'If Me.txtCliente.Text = "" Then
'limpar a Folha1
Sheets("Folha1").Select
'Range("A1:N92").Select
'Selection.ClearContents

Dim i As Long
Dim linha As Long
Dim j As Long
linha = 2
Dim ano As String

While Folha1.Range("A" & linha).Value <> ""


linha = linha + 1

Wend

Folha1.Range("A1:O" & linha).Value = ""
Folha1.Range("A1:O" & linha).Font.Bold = False

linha = 2

'ano está selecionado na cboAno
ano = Me.txtCliente.Text

'Sheets("Plan1").Cells(1, 1).Value = "Código"
'preencher a linha 1 da Plan1
For j = 1 To Me.ListView1.ColumnHeaders.Count

Sheets("Folha1").Cells(1, j).Value = Me.ListView1.ColumnHeaders(j)

Next j
       
'percorrer as linhas da Listview
' i é o número linha
For i = 1 To Me.ListView1.ListItems.Count

Sheets("Folha1").Range("A" & linha).Value = Me.ListView1.ListItems(i)
Sheets("Folha1").Range("B" & linha).Value = Me.ListView1.ListItems.Item(i).SubItems(1)
Sheets("Folha1").Range("C" & linha).Value = Me.ListView1.ListItems.Item(i).SubItems(2)
'percorrer as colunas da Listview
For j = 3 To Me.ListView1.ColumnHeaders.Count - 1

Sheets("Folha1").Cells(linha, j + 1).Value = Me.ListView1.ListItems.Item(i).SubItems(j)

Next j

linha = linha + 1

Next i
Call TextoParaNumerico
'End If
Sheets("Folha1").Range("D" & linha & ":O" & linha).Value = ""
If Me.ListView1.ColumnHeaders.Count = 15 Then
Folha1.Range("D" & linha).Value = CCur(WorksheetFunction.Sum(Folha1.Range("D2:D" & linha - 1)))
Folha1.Range("E" & linha).Value = CCur(WorksheetFunction.Sum(Folha1.Range("E2:E" & linha - 1)))
Folha1.Range("F" & linha).Value = CCur(WorksheetFunction.Sum(Folha1.Range("F2:F" & linha - 1)))
Folha1.Range("G" & linha).Value = CCur(WorksheetFunction.Sum(Folha1.Range("G2:G" & linha - 1)))
Folha1.Range("H" & linha).Value = CCur(WorksheetFunction.Sum(Folha1.Range("H2:H" & linha - 1)))
Folha1.Range("I" & linha).Value = CCur(WorksheetFunction.Sum(Folha1.Range("I2:I" & linha - 1)))
Folha1.Range("J" & linha).Value = CCur(WorksheetFunction.Sum(Folha1.Range("J2:J" & linha - 1)))
Folha1.Range("K" & linha).Value = CCur(WorksheetFunction.Sum(Folha1.Range("K2:K" & linha - 1)))
Folha1.Range("L" & linha).Value = CCur(WorksheetFunction.Sum(Folha1.Range("L2:L" & linha - 1)))
Folha1.Range("M" & linha).Value = CCur(WorksheetFunction.Sum(Folha1.Range("M2:M" & linha - 1)))
Folha1.Range("N" & linha).Value = CCur(WorksheetFunction.Sum(Folha1.Range("N2:N" & linha - 1)))
Folha1.Range("O" & linha).Value = CCur(WorksheetFunction.Sum(Folha1.Range("O2:O" & linha - 1)))
Folha1.Range("D" & linha & ":O" & linha).Font.Bold = True
Folha1.Range("B" & linha) = "Totais"
Folha1.Range("B" & linha).Font.Bold = True
Folha1.Range("B" & linha).HorizontalAlignment = xlCenter

End If

'If Me.ListView1.ColumnHeaders.Count = 4 Then
'Folha1.Range("D" & linha).Value = CCur(WorksheetFunction.Sum(Folha1.Range("D2:D" & linha - 1)))
'Folha1.Range("D" & linha).Font.Bold = True
'End If

'Folha1.txtAnoatual.Text = frmPagamentoConsolidado.ListView1.ListItems.Item(i).SubItems(1)

'Exibe uma caixa de dialogo para seleção da impressora que deseja imprimir
X = Application.Dialogs(xlDialogPrinterSetup).Show
If X = False Then
Exit Sub
End If

'Imprimindo o arquivo em CCURo de arquivo .mdi abre com visualizador nativo do windows, pode ser impresso posteriormente
ActiveWindow.SelectedSheets.PrintOut Copies:=1, ActivePrinter:="Microsoft Office Document Image Writer em Ne01:", Collate:=True

End Sub

Private Sub CommandButton1_Click()
Unload Me
End Sub

Private Sub txtCliente_Change()

Me.ListView1.ListItems.Clear

If Me.txtCliente.Text = "" Then

Dim LISTA As ListItem
Dim ano As String
Dim linha As Long
Dim i As Integer
soma = 0
For NumPlan = 1 To ThisWorkbook.Sheets.Count

If Sheets(NumPlan).Name <> "Plan1" Then
If Sheets(NumPlan).Name <> "Plan2" Then
If Sheets(NumPlan).Name <> "Folha1" Then

ano = Sheets(NumPlan).Name

'Dim LISTA As ListItem
'Dim linha As Long
linha = 2

While Sheets(ano).Range("A" & linha).Value <> ""
'If UCase(texto) = Left(UCase(Sheets(ano).Range("B" & linha).Value), Len(texto)) Or UCase(texto) = Left(UCase(Sheets(ano).Range("B" & linha).Value), Len(texto)) Then
Set LISTA = ListView1.ListItems.Add(, , ano)

        LISTA.SubItems(1) = Sheets(ano).Range("A" & linha).Value
        LISTA.SubItems(2) = Sheets(ano).Range("B" & linha).Value
        For i = 3 To 14
        LISTA.SubItems(i) = Format(Sheets(ano).Cells(linha, i).Value - Sheets(ano).Cells(linha, i + 12).Value, "currency")
        soma = soma + Sheets(ano).Cells(linha, i).Value - Sheets(ano).Cells(linha, i + 12).Value
        txtSoma.Text = Format(soma, "currency")
        Next i
'End If
linha = linha + 1

Wend

End If
End If
End If

Next NumPlan

Else
soma = 0
For NumPlan = 1 To ThisWorkbook.Sheets.Count

If Sheets(NumPlan).Name <> "Plan1" Then
If Sheets(NumPlan).Name <> "Plan2" Then
If Sheets(NumPlan).Name <> "Folha1" Then

ano = Sheets(NumPlan).Name

Call PREENCHERLISTA21(Me.ListView1, ano, Me.txtCliente, Me.txtSoma)

End If
End If
End If
Next NumPlan

End If

End Sub



Private Sub UserForm_Initialize()

Dim LISTA As ListItem
       
    With ListView1
        With .ColumnHeaders
            .Clear
            .Add , , "Ano", 30
            .Add , , "Código", 40, lvwColumnCenter
            .Add , , "Cliente", 250, lvwColumnLeft
            .Add , , "Janeiro", 52, lvwColumnRight
            .Add , , "Fevereiro", 52, lvwColumnRight
            .Add , , "Março", 52, lvwColumnRight
            .Add , , "Abril", 52, lvwColumnRight
            .Add , , "Maio", 52, lvwColumnRight
            .Add , , "Junho", 52, lvwColumnRight
            .Add , , "Julho", 52, lvwColumnRight
            .Add , , "Agosto", 52, lvwColumnRight
            .Add , , "Setembro", 52, lvwColumnRight
            .Add , , "Outubro", 52, lvwColumnRight
            .Add , , "Novembro", 52, lvwColumnRight
            .Add , , "Dezembro", 52, lvwColumnRight
        End With
        .View = lvwReport
        .FullRowSelect = True
    End With
   
Dim ano As String
Dim linha As Long
Dim i As Integer
Dim soma As Double

For NumPlan = 1 To ThisWorkbook.Sheets.Count

If Sheets(NumPlan).Name <> "Plan1" Then
If Sheets(NumPlan).Name <> "Plan2" Then
If Sheets(NumPlan).Name <> "Folha1" Then

ano = Sheets(NumPlan).Name

'Dim LISTA As ListItem
'Dim linha As Long
linha = 2

While Sheets(ano).Range("A" & linha).Value <> ""
'If UCase(texto) = Left(UCase(Sheets(ano).Range("B" & linha).Value), Len(texto)) Or UCase(texto) = Left(UCase(Sheets(ano).Range("B" & linha).Value), Len(texto)) Then
Set LISTA = ListView1.ListItems.Add(, , ano)

        LISTA.SubItems(1) = Sheets(ano).Range("A" & linha).Value
        LISTA.SubItems(2) = Sheets(ano).Range("B" & linha).Value
        For i = 3 To 14
        LISTA.SubItems(i) = Format(Sheets(ano).Cells(linha, i).Value - Sheets(ano).Cells(linha, i + 12).Value, "currency")
        soma = soma + Sheets(ano).Cells(linha, i).Value - Sheets(ano).Cells(linha, i + 12).Value
        txtSoma.Text = Format(soma, "currency")
        Next i
'End If
linha = linha + 1

Wend

End If
End If
End If

Next NumPlan

End Sub

 
Postado : 15/04/2020 4:05 pm