Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Tópicos relacionados a códigos VBA, gravação de macros, etc.
Por vilc
Posts
#70115
Boa tarde, estou com esse código , quando seleciono um item no listbox e clico no botão imprimir, a planilha que recebe os dados para impressão, a data de fechamento está ficando invertida. segue abaixo o codigo:

Private Sub BtnImprimir_Click()

Sheets("Relatorio").Select

'testa se a list esta vazia
If ListBoxConcluidos.ListCount = 0 Then
MsgBox ("Não há itens a serem impressos..."), vbInformation, ("Erro")
Else






'limpa dados antes de lançar os novos dados
If Range("A2").Select = "" Then
'não faz nanda
Else
'apaga o intervalo
Range("A2").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.ClearContents
Range("A2").Select
End If

'lança os dados na planilha

Dim Item As Double
Dim linha As Integer
'Dim valor_unitario As Double
'Dim valor_total As Double

linha = 2

For Item = 0 To ListBoxConcluidos.ListCount - 1

If ListBoxConcluidos.Selected(Item) = True Then


Sheets("Relatorio").Cells(linha, 1) = ListBoxConcluidos.List(Item, 0) 'codigo 'A
Sheets("Relatorio").Cells(linha, 5) = ListBoxConcluidos.List(Item, 1) 'descrição 'E
Sheets("Relatorio").Cells(linha, 2) = ListBoxConcluidos.List(Item, 2) 'data "B
Sheets("Relatorio").Cells(linha, 6) = ListBoxConcluidos.List(Item, 3) 'patrimonio 'F 'prioridade 'D
Sheets("Relatorio").Cells(linha, 7) = ListBoxConcluidos.List(Item, 4) 'solicitante 'G
Sheets("Relatorio").Cells(linha, 8) = ListBoxConcluidos.List(Item, 5) 'secretaria "H
Sheets("Relatorio").Cells(linha, 12) = ListBoxConcluidos.List(Item, 6) 'tecnico "L
Sheets("Relatorio").Cells(linha, 10) = ListBoxConcluidos.List(Item, 7) 'status " 'J
Sheets("Relatorio").Cells(linha, 14) = ListBoxConcluidos.List(Item, 8) 'parecer tecnico 'N
Sheets("Relatorio").Cells(linha, 11) = ListBoxConcluidos.List(Item, 9) 'data fechamento 'prioridade 'D

'Sheets("Relatorio").Cells(linha, 4) = valor_unitario
'Sheets("Relatorio").Cells(linha, 5) = valor_total

ActiveWorkbook.Save





Unload Me

Unload FormInicio

Sheets("Imprimir").Select
ActiveSheet.PrintPreview

'Application.Dialogs(xlDialogPrinterSetup).Show

ActiveWorkbook.Save


'ActiveWorkbook.Save

'Sheets("Imprimir").PrintOut

'Application.Dialogs(xlDialogPrintPreview).Show




linha = linha + 1

End If


Next


End If
Sheets("inicio").Select

FormInicio.Show
Call ContarChamados 'conta a quantidade de chamados codigo no modulo 8









End Sub
Por osvaldomp
#70121
Veja se algum desses funciona aí.

Sheets("Relatorio").Cells(linha, 11) = Format(ListBoxConcluidos.List(Item, 9), "dd/mm/yyyy") 'data fechamento 'prioridade 'D
Sheets("Relatorio").Cells(linha, 11) = Format(ListBoxConcluidos.List(Item, 9), "mm/dd/yyyy") 'data fechamento 'prioridade 'D
Por vilc
Posts
#70126
osvaldomp escreveu: 04 Abr 2022 às 15:56 Veja se algum desses funciona aí.

Sheets("Relatorio").Cells(linha, 11) = Format(ListBoxConcluidos.List(Item, 9), "dd/mm/yyyy") 'data fechamento 'prioridade 'D
Sheets("Relatorio").Cells(linha, 11) = Format(ListBoxConcluidos.List(Item, 9), "mm/dd/yyyy") 'data fechamento 'prioridade 'D

osvaldomp, muito obrigado funcionou aqui!... estava toda hora fechando o formulário e acertando a data na planilha... vlw mesmo...
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord