Forum

Notifications
Clear all

change print out

3 Posts
2 Users
0 Reactions
72 Views
(@bjarnehansen)
Posts: 3
Active Member
Topic starter
 

Hey

i have a ? aboud a macro wher i print out a list from sheet "bogføring" but it print all out
i want it to only print out the select year i sheet "T" C2 if i change year in C2 the print out will change

and the year start in sheet "T" C4 and end in sheet "T" C5

the year can also start 1-11-21 and end 30-10-22

in sheet "bogføring" i only have 2 year now but more will com

sorry my english

 
Posted : 11/02/2022 11:56 am
(@catalinb)
Posts: 1937
Member Admin
 

Hi,

Try this code for filtering:

Dim StartDate As Date, EndDate As Date
StartDate = ThisWorkbook.Worksheets("T").Cells(4, "C").Value2
EndDate = ThisWorkbook.Worksheets("T").Cells(5, "C").Value2

ActiveSheet.Range("$A$5:$J$2392").AutoFilter Field:=1, Criteria1:= _
">=" & CDbl(StartDate), Operator:=xlAnd, Criteria2:="<=" & CDbl(EndDate)

 
Posted : 14/02/2022 11:50 pm
(@bjarnehansen)
Posts: 3
Active Member
Topic starter
 

Hey

 

thanks, it works i think after a short test

but have can i get the hole list back after print, ther is only that i have printet

 
Posted : 15/02/2022 1:43 pm
Share: