Bonjour,
je souhaite exporter le résultat de plusieurs filtres ( liste déroulante ) sur un formulaire En Excel , en cliquant sur un bouton tout simplement.
pour info : j'obtiens le résultat des filtres en cliquant sur un bouton de commande dont le code est :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78 Private Sub CmdFiltre_Click() f = "" If Not IsNull(Me.RRLP) And Me.RRLP <> "" Then f = "RLP LIKE ""*" & Me.RRLP & "*""" End If If Not IsNull(Me.RCalibres) And Me.RCalibres <> "" Then If f <> "" Then f = f & " AND Calibre = """ & Me.RCalibres & """" Else f = "Calibre = """ & Me.RCalibres & """" End If End If If Not IsNull(Me.RRCP) And Me.RRCP <> "" Then If f <> "" Then f = f & " AND RCP = """ & Me.RRCP & """" Else f = "RCP = """ & Me.RRCP & """" End If End If If Not IsNull(Me.RLPR) And Me.RLPR <> "" Then If f <> "" Then f = f & " AND LPR = """ & Me.RLPR & """" Else f = "LPR = """ & Me.RLPR & """" End If End If If Not IsNull(Me.RLD) And Me.RLD <> "" Then If f <> "" Then f = f & " AND Batiment = """ & Me.RLD & """" Else f = "Batiment = """ & Me.RLD & """" End If End If If Not IsNull(Me.RRQP) And Me.RRQP <> "" Then If f <> "" Then f = f & " AND RQP LIKE ""*" & Me.RRQP & "*""" Else f = "RQP LIKE ""*" & Me.RRQP & "*""" End If End If If Not IsNull(Me.RE_FTA) And Me.RE_FTA <> "" Then If f <> "" Then f = f & " AND Etat_FTA LIKE ""*" & Me.RE_FTA & "*""" Else f = "Etat_FTA LIKE ""*" & Me.RE_FTA & "*""" End If End If If Not IsNull(Me.RDPA) And Me.RDPA <> "" Then If f <> "" Then f = f & " AND DPA LIKE ""*" & Me.RDPA & "*""" Else f = "DPA LIKE ""*" & Me.RDPA & "*""" End If End If If Not IsNull(Me.RPRI) And Me.RPRI <> "" Then If f <> "" Then f = f & " AND PRI LIKE ""*" & Me.RPRI & "*""" Else f = "PRI LIKE ""*" & Me.RPRI & "*""" End If End If If Not IsNull(Me.RNiveau) And Me.RNiveau <> "" Then If f <> "" Then f = f & " AND Niveau LIKE ""*" & Me.RNiveau & "*""" Else f = "Niveau LIKE ""*" & Me.RNiveau & "*""" End If End If If Not IsNull(Me.Rdate1) And Me.Rdate1 <> "" And Not IsNull(Me.Rdate2) And Me.Rdate2 <> "" Then If f <> "" Then f = f & " AND clng([Date de détection]) BETWEEN " & CLng(Me.Rdate1) & " AND " & CLng(Me.Rdate2) & "" Else f = "clng([Date de détection]) BETWEEN " & CLng(Me.Rdate1) & " AND " & CLng(Me.Rdate2) & "" End If End If Me.Filter = f Me.FilterOn = True End Sub
Merci de m 'aider je suis bloqué pour l'instant ,je suis débutant en VBA , ce code je l ai trouve sur le net.
Cdlt
Quand tu postes du code, tu dois l'insérer dans les balises !
http://dolphy35.developpez.com/images/Balises.gif
Partager