473,511 Members | 15,081 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

display values

1 New Member
hi. Right now, I’m working on a code that allows me to manipulate a pivot table (especially filters). But my problem is that when I run the code it doesn’t visualize the values inside the pivot table and sometimes the filters don’t work either . Does somebody knows a code to manipulate a filter using a listbox????. I’m using the following code:
Expand|Select|Wrap|Line Numbers
  1. Private Sub PRODUCCION_Click()
  2. Application.ScreenUpdating = False
  3. Sheets("PRODUCCION").Select
  4.  
  5. Dim intASO As Integer
  6. Dim dStart As Date
  7. Dim dEnd As Date
  8. Dim pt As PivotTable
  9. Dim pf As PivotField
  10. Dim pi As PivotItem
  11.  
  12. Application.ScreenUpdating = False
  13. ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh
  14.  
  15. On Error Resume Next
  16.  
  17. dStart = fecha1.Value
  18. dEnd = fecha2.Value
  19.  
  20. Set pt = ActiveSheet.PivotTables("PivotTable1")
  21. Set pf = pt.PivotFields("Fecha")
  22.  
  23. pt.ManualUpdate = True
  24.  
  25. pf.EnableMultiplePageItems = True
  26.  
  27. For Each pi In pf.PivotItems
  28. pi.Visible = True
  29. Next pi
  30.  
  31. For Each pi In pf.PivotItems
  32. If pi.Value < dStart Or pi.Value > dEnd Then
  33. pi.Visible = False
  34. End If
  35. Next pi
  36.  
  37. Application.ScreenUpdating = False
  38. pt.ManualUpdate = False
  39.  
  40.  
  41. If CheckBox1.Value = True Then
  42.  
  43. ActiveSheet.PivotTables("PivotTable1").ManualUpdate = True
  44. ActiveSheet.PivotTables("PivotTable1").PivotFields("Turno").EnableMultiplePageItems = True
  45.  
  46. With ActiveSheet.PivotTables("PivotTable1").PivotFields("Turno")
  47. intASO = .AutoSortOrder
  48. .AutoSort xlManual, .SourceName
  49. .PivotItems("B").Visible = False
  50. .PivotItems("A").Visible = True
  51. .AutoSort intASO, .SourceName
  52. .Orientation = xlPageField
  53. End With
  54. End If
  55.  
  56. If TURNOB.Value = True Then
  57. ActiveSheet.PivotTables("PivotTable1").ManualUpdate = True
  58. ActiveSheet.PivotTables("PivotTable1").PivotFields("Turno").EnableMultiplePageItems = True
  59.  
  60. With ActiveSheet.PivotTables("PivotTable1").PivotFields("Turno")
  61. intASO = .AutoSortOrder
  62. .AutoSort xlManual, .SourceName
  63. .PivotItems("A").Visible = False
  64. .PivotItems("B").Visible = True
  65. .AutoSort intASO, .SourceName
  66. .Orientation = xlPageField
  67. End With
  68. End If
  69.  
  70. If TURNOB.Value = True And CheckBox1.Value = True Then
  71. ActiveSheet.PivotTables("PivotTable1").ManualUpdate = True
  72. ActiveSheet.PivotTables("PivotTable1").PivotFields("Turno").EnableMultiplePageItems = True
  73.  
  74. With ActiveSheet.PivotTables("PivotTable1").PivotFields("Turno")
  75. intASO = .AutoSortOrder
  76. .AutoSort xlManual, .SourceName
  77. .PivotItems("A").Visible = True
  78. .PivotItems("B").Visible = True
  79. .AutoSort intASO, .SourceName
  80. .Orientation = xlPageField
  81. End With
  82. End If
  83.  
  84. If CheckBox1.Value = False And TURNOB.Value = False Then
  85. MsgBox ("Selecione al menos un Turno")
  86. Exit Sub
  87. End If
  88.  
  89. If SALIDA1.Value = True Then
  90. ActiveSheet.PivotTables("PivotTable1").ManualUpdate = True
  91. ActiveSheet.PivotTables("PivotTable1").PivotFields("Salida").EnableMultiplePageItems = True
  92.  
  93. With ActiveSheet.PivotTables("PivotTable1").PivotFields("Salida")
  94. intASO = .AutoSortOrder
  95. .AutoSort xlManual, .SourceName
  96. .PivotItems("SALIDA 2").Visible = False
  97. .PivotItems("SALIDA 1").Visible = True
  98. .AutoSort intASO, .SourceName
  99. .Orientation = xlPageField
  100.  
  101. End With
  102. End If
  103.  
  104. If SALIDA2.Value = True And SALIDA1.Value = False Then
  105. ActiveSheet.PivotTables("PivotTable1").ManualUpdate = True
  106. ActiveSheet.PivotTables("PivotTable1").PivotFields("Salida").EnableMultiplePageItems = True
  107. With ActiveSheet.PivotTables("PivotTable1").PivotFields("Salida")
  108. intASO = .AutoSortOrder
  109. .AutoSort xlManual, .SourceName
  110. .PivotItems("SALIDA 2").Visible = True
  111. .PivotItems("SALIDA 1").Visible = False
  112. .AutoSort intASO, .SourceName
  113. .Orientation = xlPageField
  114.  
  115. End With
  116. End If
  117.  
  118. If SALIDA2.Value = True And SALIDA1.Value = True Then
  119. ActiveSheet.PivotTables("PivotTable1").ManualUpdate = True
  120. ActiveSheet.PivotTables("PivotTable1").PivotFields("Salida").EnableMultiplePageItems = True
  121.  
  122. With ActiveSheet.PivotTables("PivotTable1").PivotFields("Salida")
  123. intASO = .AutoSortOrder
  124. .AutoSort xlManual, .SourceName
  125. .PivotItems("SALIDA 2").Visible = True
  126. .PivotItems("SALIDA 1").Visible = True
  127. .AutoSort intASO, .SourceName
  128. .Orientation = xlPageField
  129.  
  130. End With
  131. End If
  132.  
  133. If SALIDA1.Value = False And SALIDA2.Value = False Then
  134. MsgBox ("Selecione al menos una Saldia")
  135. Exit Sub
  136. End If
  137.  
  138. If CUADRILLA1.Value = True And CUADRILLA2.Value = False And CUADRILLA3.Value = False Then
  139. ActiveSheet.PivotTables("PivotTable1").ManualUpdate = True
  140. ActiveSheet.PivotTables("PivotTable1").PivotFields("Cuadrilla").EnableMultiplePageItems = True
  141.  
  142. With ActiveSheet.PivotTables("PivotTable1").PivotFields("Cuadrilla")
  143. intASO = .AutoSortOrder
  144. .AutoSort xlManual, .SourceName
  145. .PivotItems("2").Visible = False
  146. .PivotItems("1").Visible = True
  147. .PivotItems("3").Visible = False
  148. .AutoSort intASO, .SourceName
  149. .Orientation = xlPageField
  150. End With
  151. End If
  152.  
  153. If CUADRILLA1.Value = False And CUADRILLA2.Value = True And CUADRILLA3.Value = False Then
  154.  
  155. With ActiveSheet.PivotTables("PivotTable1").PivotFields("Cuadrilla")
  156. intASO = .AutoSortOrder
  157. .AutoSort xlManual, .SourceName
  158. .PivotItems("2").Visible = True
  159. .PivotItems("1").Visible = False
  160. .PivotItems("3").Visible = False
  161. .AutoSort intASO, .SourceName
  162. .Orientation = xlPageField
  163. End With
  164. End If
  165.  
  166. If CUADRILLA1.Value = False And CUADRILLA2.Value = False And CUADRILLA3.Value = True Then
  167.  
  168. With ActiveSheet.PivotTables("PivotTable1").PivotFields("Cuadrilla")
  169. intASO = .AutoSortOrder
  170. .AutoSort xlManual, .SourceName
  171. .PivotItems("2").Visible = False
  172. .PivotItems("1").Visible = False
  173. .PivotItems("3").Visible = True
  174. .AutoSort intASO, .SourceName
  175. .Orientation = xlPageField
  176. End With
  177. End If
  178.  
  179.  
  180. If CUADRILLA1.Value = True And CUADRILLA2.Value = True And CUADRILLA3.Value = True Then
  181. ActiveSheet.PivotTables("PivotTable1").ManualUpdate = True
  182. ActiveSheet.PivotTables("PivotTable1").PivotFields("Cuadrilla").EnableMultiplePageItems = True
  183.  
  184. With ActiveSheet.PivotTables("PivotTable1").PivotFields("Cuadrilla")
  185. intASO = .AutoSortOrder
  186. .AutoSort xlManual, .SourceName
  187. .PivotItems("2").Visible = True
  188. .PivotItems("1").Visible = True
  189. .PivotItems("3").Visible = True
  190. .AutoSort intASO, .SourceName
  191. .Orientation = xlPageField
  192. End With
  193. End If
  194.  
  195. If CUADRILLA1.Value = False And CUADRILLA2.Value = False And CUADRILLA3.Value = False Then
  196. MsgBox ("Selecione al menos una Cuadrilla")
  197. Exit Sub
  198. End If
  199.  
  200.  
  201. ActiveSheet.PivotTables("PivotTable1").PivotCache.Refresh
  202.  
  203. Unload REPORTE
  204. End Sub
  205.  
Jun 3 '10 #1
0 930

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2439
by: Ravi | last post by:
My xml looks like <abc> 23 45 67 2 123 </abc> I wish to display these values comma separated 23; 45; 67; 2; 123
13
5516
by: Gunnar | last post by:
Hello, I am running into problems with a simple function which should change the style.display properties from 'block' to 'none'. I am able to change them from 'none' to 'block' as expected. ...
4
6922
by: neena | last post by:
how to display values from database tables without using datagrid control in C# .net.I want to search the values from database & the search results to be shown as rows in the web form,without the use...
1
1568
by: Eric | last post by:
Is it possible that in a continous form i create a listbox which is not a part of a table and disply some values. For eg: TableA has a field FieldA. I run a query on TableA when it loads it match...
1
1228
by: nithu | last post by:
hi frens, i am an fresh graduate..... n also new to vb..... pls help me.... how to display values in text boxes retrieved from db in printable format? any sort of help or...
1
2123
by: snipersix | last post by:
How do you display values in a textarea using javascript. ex. i have 2 radio buttons o Adult =$9.99 o Child =$6.99 i need it to be, so that if i select adult in the...
4
1327
by: Aneena | last post by:
Hi, I want to display the values in a combo box based upon the values in the first combo box.I know that I have to use javascript.Please can u help me by providing the code to develop the same
2
1796
by: bhargavi514 | last post by:
friends i need a php code to retrieve 10 records from database and display values in a table by using php and my sql
8
2869
by: ardhuru | last post by:
Hello, I am a complete newbie with VB, so this question might sound really stupid; please bear with me. My question is, can a combo box be used to display a value in the sense a label can? I...
1
2298
by: lrheeza | last post by:
Hello, More questions from this newbie: I have an Application table which has Application ID and Application Name. I have another table Variable which has Variable ID, Application ID and other...
0
7371
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7432
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
5077
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1583
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
452
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.