Skip to main content

Conas gach tábla pivot a liostáil ó leabhar oibre?

Má tá leabhar mór oibre agat ina bhfuil iliomad táblaí pivot, anois, ba mhaith leat na táblaí pivot uile sa leabhar oibre seo a liostáil, an féidir? Ar ndóigh, is fearr leat an cód VBA seo a leanas san alt seo. Chun níos mó sonraí a fháil, léigh an t-alt thíos le do thoil.

Liostaigh gach tábla pivot ó leabhar oibre le cód VBA


mboilgeog cheart gorm saighead Liostaigh gach tábla pivot ó leabhar oibre le cód VBA

Is féidir leis an gcód VBA seo a leanas cabhrú leat na hainmneacha tábla pivot go léir a liostáil mar aon lena dtréithe, mar shampla raon sonraí foinse, ainm na bileoige oibre, dáta athnuachana agus mar sin de.

1. Oscail do leabhar oibre ar mhaith leat na táblaí pivot go léir a liostáil.

2. Coinnigh síos an ALT + F11 eochracha, agus osclaíonn sé an Fuinneog Microsoft Visual Basic for Applications.

3. Cliceáil Ionsáigh > Modúil, agus greamaigh an cód seo a leanas sa Fuinneog an Mhodúil.

Cód VBA: Liostaigh na táblaí pivot go léir ó leabhar oibre

Sub ListPivotsInfor()
'Update 20141112
    Dim St As Worksheet
    Dim NewSt As Worksheet
    Dim pt As PivotTable
    Dim I, K As Long
    Application.ScreenUpdating = False
    Set NewSt = Worksheets.Add
    I = 1: K = 2
    With NewSt
        .Cells(I, 1) = "Name"
        .Cells(I, 2) = "Source"
        .Cells(I, 3) = "Refreshed by"
        .Cells(I, 4) = "Refreshed"
        .Cells(I, 5) = "Sheet"
        .Cells(I, 6) = "Location"
        For Each St In ActiveWorkbook.Worksheets
            For Each pt In St.PivotTables
                I = I + 1
                .Cells(I, 1).Value = pt.Name
                .Cells(I, 2).Value = pt.SourceData
                .Cells(I, 3).Value = pt.RefreshName
                .Cells(I, 4).Value = pt.RefreshDate
                .Cells(I, 5).Value = St.Name
                .Cells(I, 6).Value = pt.TableRange1.Address
            Next
        Next
        .Activate
    End With
    Application.ScreenUpdating = True
End Sub

4. Ansin brúigh F5 eochair chun an cód seo a rith, liostaítear na hainmneacha tábla pivot go léir, an raon sonraí foinse, ainm na bileoige oibre agus na tréithe eile i mbileog oibre nua a cuireadh os comhair do bhileog oibre ghníomhaigh mar a leanas an pictiúr a thaispeántar:

doc-liosta-uile-pivottable-1


Earraí gaolmhara:

Conas a sheiceáil an bhfuil tábla pivot ann i leabhar oibre?

Conas ilréimsí a chur le tábla pivot?

Uirlisí Táirgiúlachta Oifige is Fearr

🤖 Kutools AI Aide: anailís sonraí a réabhlóidiú bunaithe ar: Forghníomhú Chliste   |  Gin Cód  |  Cruthaigh Foirmlí Saincheaptha  |  Anailís a dhéanamh ar Sonraí agus Cairteacha a Ghin  |  Feidhmeanna Kutools a agairt...
Gnéithe Coitianta: Faigh, Aibhsigh nó Aithnigh Dúblaigh   |  Scrios Sraitheanna Bána   |  Comhcheangail Colúin nó Cealla gan Sonraí a Chailleadh   |   Babhta gan Foirmle ...
Cuardaigh Super: Ilchritéir VLookup    VLookup Illuachanna  |   VLookup Trasna Ilbhileoga   |   Amharc doiléir ....
Liosta anuas Casta: Go tapa Cruthaigh Liosta Anuas   |  Liosta anuas Cleithiúnach   |  Liosta Buail Isteach Ilroghnacha ....
Bainisteoir Colún: Cuir Líon Sonrach Colún leis  |  Colúin Bog  |  Scoránaigh Stádas Infheictheachta na gColún Ceilte  |  Déan comparáid idir Raonta & Colúin ...
Gnéithe Réadmhaoin: Fócas Eangaí   |  Amharc Dearaidh   |   Barra Mór na Foirmle    Leabhar Oibre & Bainisteoir Bileog   |  Leabharlann Acmhainní (Uaththéacs)   |  Piocálaí Dáta   |  Comhcheangail Bileoga Oibre   |  Criptigh/Díchriptigh Cealla    Seol Ríomhphost trí Liosta   |  Scagaire Super   |   Scagaire Speisialta (scagaire trom/iodálach/stailc tríd...) ...
Barr 15 Uirlisí12 Téacs uirlisí (Cuir Téacs, Bain Carachtair,...)   |   50 + Cairt cineálacha (Cairt Gantt,...)   |   40+ Praiticiúil Foirmlí (Ríomh aois bunaithe ar lá breithe,...)   |   19 Insertion uirlisí (Cuir isteach Cód QR, Ionsáigh Pictiúr ón gCosán,...)   |   12 Tiontú uirlisí (Uimhreacha le Focail, Comhshó Airgeadra,...)   |   7 Cumaisc & Scoilt uirlisí (Sraitheanna Comhcheangail Casta, Cealla Scoilt,...)   |   ... agus eile

Supercharge Do Scileanna Excel le Kutools le haghaidh Excel, agus Éifeachtúlacht Taithí Cosúil Ná Roimhe. Kutools le haghaidh Excel Tairiscintí Níos mó ná 300 Ardghnéithe chun Táirgiúlacht a Treisiú agus Sábháil Am.  Cliceáil anseo chun an ghné is mó a theastaíonn uait a fháil ...

Tuairisc


Tugann Tab Oifige comhéadan Tabbed chuig Office, agus Déan Do Obair i bhfad Níos Éasca

  • Cumasaigh eagarthóireacht agus léamh tabbed i Word, Excel, PowerPoint, Foilsitheoir, Rochtain, Visio agus Tionscadal.
  • Oscail agus cruthaigh cáipéisí iolracha i gcluaisíní nua den fhuinneog chéanna, seachas i bhfuinneoga nua.
  • Méadaíonn do tháirgiúlacht 50%, agus laghdaíonn sé na céadta cad a tharlaíonn nuair luch duit gach lá!
Comments (20)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
unfortunately I'm getting multiple errors, this would have been absolutely great for my multi-tab, multi-pivot workbooks
This comment was minimized by the moderator on the site
Fit perfeclty!! Thanks a lot
This comment was minimized by the moderator on the site
run time error 1004
This comment was minimized by the moderator on the site
Huge help, saved me a ton of time tracking down one of a number of identically named pivot tables in a Workbook!
This comment was minimized by the moderator on the site
That's Awesome.
This comment was minimized by the moderator on the site
VERY handy to have in a pinch! Thank you.
This comment was minimized by the moderator on the site
Thanks for the post, I cleaned up the code a little by defining I and Long and deleting the ref to K since it wasn't used. Lastly I added a line just below your .Activate to show .Columns.AutoFit
This comment was minimized by the moderator on the site
This is awesome! I have been looking for a code like this one, but with the addition of showing all active fields per table. I need to clean up the source tables from unnecessary fields (too heavy) and they feed a book of over 300 pivots. I'd prefer not to go one pivot table at a time to figure out which fields I can eliminate... If you could show me how, it would be incredible... Thanks!
This comment was minimized by the moderator on the site
Amazing!!! thksss!!!!
This comment was minimized by the moderator on the site
Saved me from a major headache!
Couldn't find what pivot table was causing a "Refresh All Error"
Boom Listed with locations, Thank you so much
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations