Hochkommer Eintrag variieren

  • Excel

Es gibt 1 Antwort in diesem Thema. Der letzte Beitrag () ist von Cell.

    Hochkommer Eintrag variieren

    Ich habe eine Frage zu Visual Basic Das Problem ist die Bezeichnung von ("PivotTable2") Ich will das es egal ist, welche Nummer dahinter steht?
    ("PivotTable1") =("PivotTable2") =("PivotTable3") =("PivotTable4") =("PivotTable5")

    MÜSSTE in diesem Forum für niemanden ein Problem sein. Trotzdem bedanke ich mich für die Hilfe :thumbup: :thumbup:
    Spoiler anzeigen

    VB.NET-Quellcode

    1. Sub PivotTableForm()
    2. '
    3. ' PivotTableForm Makro
    4. '
    5. '
    6. With ActiveSheet.PivotTables("PivotTable2").PivotFields("SP")
    7. .Orientation = xlColumnField
    8. .Position = 1
    9. End With
    10. ActiveSheet.PivotTables("PivotTable2").AddDataField ActiveSheet.PivotTables( _
    11. "PivotTable2").PivotFields("ProdNr"), "Summe von ProdNr", xlSum
    12. With ActiveSheet.PivotTables("PivotTable2").PivotFields("Folgeknoten")
    13. .Orientation = xlRowField
    14. .Position = 1
    15. End With
    16. ActiveSheet.PivotTables("PivotTable2").PivotSelect "'Row Grand Total'", _
    17. xlDataAndLabel, True
    18. Range("D4").Select
    19. ActiveSheet.PivotTables("PivotTable2").GrandTotalName = "Gesamt"
    20. Range("C4").Select
    21. ActiveSheet.PivotTables("PivotTable2").PivotFields("SP").PivotItems("(blank)"). _
    22. Caption = "Frei"
    23. Range("B3").Select
    24. ActiveSheet.PivotTables("PivotTable2").CompactLayoutColumnHeader = ""
    25. Range("B4").Select
    26. ActiveSheet.PivotTables("PivotTable2").PivotSelect "", xlDataAndLabel, True
    27. Selection.Borders(xlDiagonalDown).LineStyle = xlNone
    28. Selection.Borders(xlDiagonalUp).LineStyle = xlNone
    29. With Selection.Borders(xlEdgeLeft)
    30. .LineStyle = xlContinuous
    31. .ColorIndex = 0
    32. .TintAndShade = 0
    33. .Weight = xlThin
    34. End With
    35. With Selection.Borders(xlEdgeTop)
    36. .LineStyle = xlContinuous
    37. .ColorIndex = 0
    38. .TintAndShade = 0
    39. .Weight = xlThin
    40. End With
    41. With Selection.Borders(xlEdgeBottom)
    42. .LineStyle = xlContinuous
    43. .ColorIndex = 0
    44. .TintAndShade = 0
    45. .Weight = xlThin
    46. End With
    47. With Selection.Borders(xlEdgeRight)
    48. .LineStyle = xlContinuous
    49. .ColorIndex = 0
    50. .TintAndShade = 0
    51. .Weight = xlThin
    52. End With
    53. With Selection.Borders(xlInsideVertical)
    54. .LineStyle = xlContinuous
    55. .ColorIndex = 0
    56. .TintAndShade = 0
    57. .Weight = xlThin
    58. End With
    59. With Selection.Borders(xlInsideHorizontal)
    60. .LineStyle = xlContinuous
    61. .ColorIndex = 0
    62. .TintAndShade = 0
    63. .Weight = xlThin
    64. End With
    65. With Selection.Font
    66. .Name = "Calibri"
    67. .Size = 14
    68. .Strikethrough = False
    69. .Superscript = False
    70. .Subscript = False
    71. .OutlineFont = False
    72. .Shadow = False
    73. .Underline = xlUnderlineStyleNone
    74. .ThemeColor = xlThemeColorLight1
    75. .TintAndShade = 0
    76. .ThemeFont = xlThemeFontMinor
    77. End With
    78. Columns("A:A").EntireColumn.AutoFit
    79. Cells.Select
    80. Cells.EntireColumn.AutoFit
    81. Range("C6").Select
    82. ActiveSheet.PivotTables("PivotTable2").PivotFields("Summe von ProdNr"). _
    83. Function = xlCount
    84. Range("D5").Select
    85. ActiveWindow.View = xlPageLayoutView
    86. Application.PrintCommunication = False
    87. With ActiveSheet.PageSetup
    88. .LeftHeader = ""
    89. .CenterHeader = ""
    90. .RightHeader = "&U &D"
    91. .LeftFooter = ""
    92. .CenterFooter = ""
    93. .RightFooter = ""
    94. .LeftMargin = Application.InchesToPoints(0.7)
    95. .RightMargin = Application.InchesToPoints(0.7)
    96. .TopMargin = Application.InchesToPoints(0.787401575)
    97. .BottomMargin = Application.InchesToPoints(0.787401575)
    98. .HeaderMargin = Application.InchesToPoints(0.3)
    99. .FooterMargin = Application.InchesToPoints(0.3)
    100. .Zoom = 100
    101. .PrintErrors = xlPrintErrorsDisplayed
    102. .OddAndEvenPagesHeaderFooter = False
    103. .DifferentFirstPageHeaderFooter = False
    104. .ScaleWithDocHeaderFooter = True
    105. .AlignMarginsHeaderFooter = True
    106. .EvenPage.LeftHeader.Text = ""
    107. .EvenPage.CenterHeader.Text = ""
    108. .EvenPage.RightHeader.Text = ""
    109. .EvenPage.LeftFooter.Text = ""
    110. .EvenPage.CenterFooter.Text = ""
    111. .EvenPage.RightFooter.Text = ""
    112. .FirstPage.LeftHeader.Text = ""
    113. .FirstPage.CenterHeader.Text = ""
    114. .FirstPage.RightHeader.Text = ""
    115. .FirstPage.LeftFooter.Text = ""
    116. .FirstPage.CenterFooter.Text = ""
    117. .FirstPage.RightFooter.Text = ""
    118. End With
    119. Application.PrintCommunication = True
    120. ActiveWindow.SmallScroll Down:=24
    121. Application.PrintCommunication = False
    122. With ActiveSheet.PageSetup
    123. .LeftHeader = ""
    124. .CenterHeader = ""
    125. .RightHeader = "&U &D"
    126. .LeftFooter = ""
    127. .CenterFooter = ""
    128. .RightFooter = "&N"
    129. .LeftMargin = Application.InchesToPoints(0.7)
    130. .RightMargin = Application.InchesToPoints(0.7)
    131. .TopMargin = Application.InchesToPoints(0.787401575)
    132. .BottomMargin = Application.InchesToPoints(0.787401575)
    133. .HeaderMargin = Application.InchesToPoints(0.3)
    134. .FooterMargin = Application.InchesToPoints(0.3)
    135. .Zoom = 100
    136. .PrintErrors = xlPrintErrorsDisplayed
    137. .OddAndEvenPagesHeaderFooter = False
    138. .DifferentFirstPageHeaderFooter = False
    139. .ScaleWithDocHeaderFooter = True
    140. .AlignMarginsHeaderFooter = True
    141. .EvenPage.LeftHeader.Text = ""
    142. .EvenPage.CenterHeader.Text = ""
    143. .EvenPage.RightHeader.Text = ""
    144. .EvenPage.LeftFooter.Text = ""
    145. .EvenPage.CenterFooter.Text = ""
    146. .EvenPage.RightFooter.Text = ""
    147. .FirstPage.LeftHeader.Text = ""
    148. .FirstPage.CenterHeader.Text = ""
    149. .FirstPage.RightHeader.Text = ""
    150. .FirstPage.LeftFooter.Text = ""
    151. .FirstPage.CenterFooter.Text = ""
    152. .FirstPage.RightFooter.Text = ""
    153. End With
    154. Application.PrintCommunication = True
    155. Range("E40").Select
    156. ActiveWindow.SmallScroll Down:=-39
    157. End Sub


    EDIT: Bitte Code-Tags verwenden. Lange Quelltext bitte in Spoilern verpacken. Keine Doppelpostings erstellen. ~fufu

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „fufu“ ()

    Wenn ich das richtig Sehe ist "Pivottable 1-4" die bezeichnung der jeweiligen Tabelle. Wenn die alle gleich benannt währen wüsste der Computer welche Pivottabelle du denn nun bearbeiten willst. Esseiden natürlich Pivottabelle 1 ist das gleiche wie 2 und 3 und 4... wenn das aber der Fall ist warum dann 4 Pivottabellen?