View Single Post
 
Old 02-20-2017, 11:24 AM
walber walber is offline Windows 10 Office 2016
Novice
 
Join Date: Jan 2017
Posts: 3
walber is on a distinguished road
Default Help with code VBA

I would like that when the month and year are selected when clicking on the sales button pull all data refent to the month and year chosen listview form according to the image.

This is the command that I want to adapt this option.

Private Sub CmdSales_Click()

With ListView1
.Gridlines = True
.View = lvwReport
FullRowSelect = True

.ColumnHeaders.Add Text:="date", Width:=60
.ColumnHeaders.Add Text:="description", Width:=200, Alignment:=2
.ColumnHeaders.Add Text:="amount", Width:=60, Alignment:=2
.ColumnHeaders.Add Text:="value", Width:=40, Alignment:=2
.ColumnHeaders.Add Text:="amount", Width:=60, Alignment:=2


End With
last line = Plan3.Cells(Plan3.Cells.Rows.Count, "a").End(xlUp).Row
ListView1.ListItems.Clear
For x = 5 To last line
Set li = ListView1.ListItems.Add(Text:=Plan3.Cells(x, "a").Value)
li.ListSubItems.Add Text:=Plan3.Cells(x, "c").Value
li.ListSubItems.Add Text:=Plan3.Cells(x, "d").Value
li.ListSubItems.Add Text:=Plan3.Cells(x, "e").Value
li.ListSubItems.Add Text:=Plan3.Cells(x, "f").Value

Next
End Sub
Attached Images
File Type: png Sem título.png (9.3 KB, 22 views)
Reply With Quote