Skip to main content

Conas ábhar cille sonraithe a ghlanadh ar oscailt agus amach i leabhar oibre Excel?

Tá an t-alt seo ag caint ar ábhar cille sonraithe a ghlanadh agus leabhar oibre Excel á oscailt nó á dhúnadh.

Glan ábhar cille sonraithe ar an leabhar oibre oscailte agus amach


Glan ábhar cille sonraithe ar an leabhar oibre oscailte agus amach

Déan mar a leanas le do thoil chun ábhar cille sonraithe a ghlanadh ar oscailt agus amach an leabhar oibre.

Ar dtús, ní mór duit an leabhar oibre a shábháil a theastaíonn uait chun ábhar cille sonraithe a ghlanadh ar oscailt nó amach mar Leabhar Oibre Macra-chumasaithe Excel.

1. Cliceáil le do thoil Comhad > Sábháil Mar > Brabhsáil. Féach an pictiúr:

2. Sa Sábháil Mar bosca dialóige, roghnaigh fillteán le do thoil chun an leabhar oibre a shábháil, cuir ainm nua isteach sa Ainm comhaid bosca de réir mar is gá duit, roghnaigh Leabhar Oibre Macra-Chumasaithe Excel ó na Sava mar chineál liosta anuas, agus ansin cliceáil ar an Sábháil cnaipe.

3. Sa popping suas Microsoft Excel bosca dialóige, cliceáil le do thoil ar an OK cnaipe mar atá thíos an pictiúr a thaispeántar.

4. Oscail an Leabhar Oibre Macra-Chumasaithe a shábháil tú díreach anois, brúigh an Eile + F11 eochracha a oscailt Microsoft Visual Basic d’Fheidhmchláir fhuinneog.

5. Sa Microsoft Visual Basic d’Fheidhmchláir fuinneog, cliceáil dúbailte An Leabhar Oibre seo sa phána ar chlé, agus ansin cóipeáil faoi bhun an chóid VBA isteach i bhfuinneog an Chóid.

Cód VBA 1: Ábhar cille sonraithe soiléir ar an leabhar oibre oscailte

Private Sub Workbook_Open()
'Updated by Extendoffice 20190712
    Application.EnableEvents = False
        Worksheets("test").Range("A1:A11").Value = ""
    Application.EnableEvents = True
End Sub

Cód VBA 2: Glan ábhar sonraithe cille ar imeacht an leabhair oibre

Private Sub Workbook_BeforeClose(Cancel As Boolean)
'Updated by Extendoffice 20190712
    Worksheets("test").Range("A1:A11").Value = ""
End Sub

nótaí: Sna cóid thuas, tástáil, agus A1: Is é A11 ainm na bileoige oibre agus an raon cille a ghlanfaidh tú an t-ábhar uaidh. Athraigh iad de réir mar is gá duit.

6. Brúigh an Eile + Q eochracha chun imeacht as an Microsoft Visual Basic d’Fheidhmchláir fhuinneog.

As seo amach, agus an leabhar oibre á oscailt nó á dhúnadh, glanfar ábhar cille sonraithe i mbileog oibre áirithe go huathoibríoch.


Earraí gaolmhara:

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 (9)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Thank You Crystal! It works.

G
This comment was minimized by the moderator on the site
Dear Friends I tried the suggested code with no effect on open>

Private Sub Workbook_Open()


Application.EnableEvents = False

Worksheets("Clienti").Range("A9:K900").Value = ""

Application.EnableEvents = True

End Sub


The macro does work from within the workbook but not when the workbook opens.

Any help would be greatly appreciated!
This comment was minimized by the moderator on the site
Hi TUDOSE GELU,
The code works well in my case.
Don't forget to put the code in the ThisWorkbook (Code) window, and save the workbook as an Excel Macro-Enabled Workbook.
https://www.extendoffice.com/images/stories/comments/comment-picture-zxm/2022-oct/oct-2.png
https://www.extendoffice.com/images/stories/comments/comment-picture-zxm/2022-oct/oct-1.png
This comment was minimized by the moderator on the site
Can someone help me how to blankout cells of sheet (only in a row and not entire Sheet). Below code removes contents in all rows of the sheet. But I want contents to be cleared only in row9



Private Sub Workbook_Open()

'Updated by Extendoffice 20190712

Application.EnableEvents = False

Worksheets("test").Range("A1:A11").Value = ""

Application.EnableEvents = True

End Sub
This comment was minimized by the moderator on the site
Hi,
The above VBA only clear the cell value of range A1:A11. If you want to clear only the values in row 9, you can replace A1:A11 with 9:9. See the below code.

Private Sub Workbook_Open()

'Updated by Extendoffice 20200522

Application.EnableEvents = False

Worksheets("test").Range("9:9").Value = ""

Application.EnableEvents = True

End Sub
This comment was minimized by the moderator on the site
Can someone help me how to blankout cells of sheet (only in a row and not entire Sheet). Below code removes contents in all rows of the sheet. But I want contents to be cleared only in row9

Private Sub Workbook_Open()

'Updated by Extendoffice 20190712

Application.EnableEvents = False

Worksheets("test").Range("A1:A11").Value = ""

Application.EnableEvents = True

End Sub
This comment was minimized by the moderator on the site
Hello, for the range how would I enter the code if I want to select multiple range or cells?
This comment was minimized by the moderator on the site
Dear sir/madam, my sheet is protected and only specified cell (for data clearing) is not protected but when i enter the value in the specified & then re-open the excel file then value is cleared by VBA code but the specified cell is protected, i have to un-protect cell by un-protecting the sheet edit the editable range again & again so please fix.
Thanks in advance
This comment was minimized by the moderator on the site
Hi Sanjay Sharma,
Sorry for the inconvinience. Please apply the below VBA codes and remember to replace the sheet name and the range to your needs. Thank you for your comment.

VBA code 1:
Private Sub Workbook_Open()
Application.EnableEvents = False
Worksheets("Sheet1").Range("A1:A11").Value = ""
Application.EnableEvents = True
End Sub

VBA code 2:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Worksheets("Sheet1").Range("A1:A11").Value = ""
End Sub
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations