Skip i'r prif gynnwys

Sut i atal dileu rhesi neu golofnau mewn llyfr gwaith heb ddiogelwch a rennir?

Pan fyddwch chi'n rhannu llyfr gwaith i eraill, sut allwch chi atal eraill rhag dileu colofnau neu resi eich llyfr gwaith a rennir heb ddiogelu'r llyfr gwaith? Yma rwy'n dod o hyd i god VBA a all atal eraill rhag dileu'r colofnau a'r rhesi mewn llyfr gwaith a rennir.

Atal dileu rhesi neu golofnau mewn llyfr gwaith a rennir gyda VBA


swigen dde glas saeth Atal dileu rhesi neu golofnau mewn llyfr gwaith a rennir gyda VBA

1. Gwasgwch Alt + F11 i agor a Microsoft Visual Basic ar gyfer Cymhwyso ffenestr.

2. Cliciwch Mewnosod > Modiwlau i agor ffenestr Modiwl, yna copïwch y VBA canlynol i'r ffenestr.

VBA: Atal dileu rhesi neu golofnau.

Sub StopDeleteRowCols()
'Updateby20221221
Dim xBarControl As CommandBarControl
Application.OnKey "^{-}", ""
For Each xBarControl In Application.CommandBars.FindControls(ID:=293)
    xBarControl.Enabled = False
Next
For Each xBarControl In Application.CommandBars.FindControls(ID:=294)
    xBarControl.Enabled = False
Next
End Sub

3. Cliciwch Run botwm neu F5 allwedd ar y bysellfwrdd i redeg y cod hwn.

Yna pan fydd eraill yn clicio ar y dde i ddileu colofnau neu resi dethol, ni ellir defnyddio'r opsiwn Dileu yn y ddewislen cyd-destun. Gweler y screenshot:

doc-disable-delete-row-row-column-1

Hefyd, mae'n atal defnyddwyr i ddefnyddio llwybr byr Ctrl + - allweddi i ddileu rhesi neu golofnau.

Nodyn:

(1) Os ydych wedi rhannu eich llyfr gwaith â adolygiad > Llyfr Gwaith Rhannu, ni allwch ychwanegu unrhyw macros VBA mwyach. Felly, byddai'n well ichi ychwanegu'r VBA cyn rhannu'r llyfr gwaith.

(2) Bydd y VBA hwn yn anablu'r Dileu yn y ddewislen cyd-destun ym mhob llyfr gwaith pan gliciwch ar dde colofnau neu resi dethol.

(3) I adfer y Dileu yn y ddewislen cyd-destun, disodli'r ddau Anghywir gyda Cywir yn y VBA uchod, a rhedeg y VBA eto.

Offer Cynhyrchiant Swyddfa Gorau

🤖 Kutools AI Aide: Chwyldro dadansoddi data yn seiliedig ar: Cyflawniad Deallus   |  Cynhyrchu Cod  |  Creu Fformiwlâu Personol  |  Dadansoddi Data a Chynhyrchu Siartiau  |  Invoke Swyddogaethau Kutools...
Nodweddion Poblogaidd: Darganfod, Amlygu neu Adnabod Dyblygiadau   |  Dileu Rhesi Gwag   |  Cyfuno Colofnau neu Gelloedd heb Colli Data   |   Rownd heb Fformiwla ...
Super-edrych: VLookup Meini Prawf Lluosog    VLookup Gwerth Lluosog  |   VLookup Ar Draws Taflenni Lluosog   |   Edrych Niwlog ....
Rhestr gwympo Uwch: Creu Rhestr Gollwng yn Gyflym   |  Rhestr Gollwng Dibynnol   |  Rhestr Gollwng Aml-ddewis ....
Rheolwr Colofn: Ychwanegu Nifer Penodol o Golofnau  |  Symud Colofnau  |  Toglo Statws Gwelededd Colofnau Cudd  |  Cymharwch Ystodau a Cholofnau ...
Nodweddion dan Sylw: Ffocws ar y Grid   |  Golwg Dylunio   |   Bar Fformiwla Mawr    Rheolwr Llyfr Gwaith a Thaflen   |  Llyfrgell Adnoddau (Testun Auto)   |  Dewiswr Dyddiad   |  Cyfuno Taflenni Gwaith   |  Amgryptio/Dadgryptio Celloedd    Anfon E-byst trwy Restr   |  Hidlo Super   |   Hidlo Arbennig (hidlo mewn print trwm/italig/strikethrough...) ...
15 Set Offer Gorau12 Testun offer (Ychwanegu Testun, Dileu Cymeriadau,...)   |   50 + Siart Mathau (Siart Gantt,...)   |   40+ Ymarferol Fformiwlâu (Cyfrifwch oedran yn seiliedig ar ben-blwydd,...)   |   19 mewnosod offer (Mewnosod Cod QR, Mewnosod Llun o'r Llwybr,...)   |   12 Trosi offer (Rhifau i Eiriau, Trosi arian cyfred,...)   |   7 Uno a Hollti offer (Rhesi Cyfuno Uwch, Celloedd Hollt,...)   |   ... a mwy

Supercharge Eich Sgiliau Excel gyda Kutools ar gyfer Excel, a Phrofiad Effeithlonrwydd Fel Erioed Erioed. Kutools ar gyfer Excel Yn Cynnig Dros 300 o Nodweddion Uwch i Hybu Cynhyrchiant ac Arbed Amser.  Cliciwch Yma i Gael Y Nodwedd Sydd Ei Angen Y Mwyaf...

Disgrifiad


Mae Office Tab yn dod â rhyngwyneb Tabbed i Office, ac yn Gwneud Eich Gwaith yn Haws o lawer

  • Galluogi golygu a darllen tabbed yn Word, Excel, PowerPoint, Cyhoeddwr, Mynediad, Visio a Phrosiect.
  • Agor a chreu dogfennau lluosog mewn tabiau newydd o'r un ffenestr, yn hytrach nag mewn ffenestri newydd.
  • Yn cynyddu eich cynhyrchiant 50%, ac yn lleihau cannoedd o gliciau llygoden i chi bob dydd!
Comments (7)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Está genial el código! Gracias! Pero esto no bloquea el poder eliminar la fila haciendo CTRL- .....
Sabrías cómo poder bloquearlo también?

Gracias!
This comment was minimized by the moderator on the site
Hi, I have updated the code in the article, you can try again, now it prevent the shortcuts and the delete command.
This comment was minimized by the moderator on the site
Bonjour

Je n'arrive plus à supprimer le fait de supprimer des lignes maintenant que j'ai créer ce code VBA.
Comment se traduit "les Vetitables" en français j'ai essayé "true" mais ça ne fonctionne pas

Merci de votre réponse
This comment was minimized by the moderator on the site
Sorry, Sand, I do not understand French.
This comment was minimized by the moderator on the site
Nice piece of code, but it doesn't prevent the user from using {ctrl} - to delete rows...
This comment was minimized by the moderator on the site
Vba code to disable delete, cut and insert option in Excel hoe ribbon
This comment was minimized by the moderator on the site
Can you Please share the vba code to disable Cut,Insert and Delete option in Home ribbon??? However i know thw vba code to disable it through right click and keyboard. But here i need code to disable cut, insert and delet option in excel home ribbon.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations