Skip i'r prif gynnwys

Sut i ddileu rhes gyfan os yw'r gell yn cynnwys sero yn Excel?

Weithiau, rydych chi am ddileu'r rhes gyfan os yw'r gell yn cynnwys sero yn Excel, a gallwch chi eu dileu fesul un os oes ychydig ohonyn nhw. Ond beth am gael gwared â channoedd o resi sy'n cynnwys sero? Gallwch ddewis un o'r ffyrdd anodd isod i'w ddatrys.

Dileu rhes os yw'r gell yn cynnwys sero gyda swyddogaeth Hidlo yn Excel
Dileu rhes os yw'r gell yn cynnwys sero gyda VBA yn Excel
Dileu rhes os yw cell yn cynnwys sero gyda Kutools ar gyfer Excel


Dileu rhes os yw'r gell yn cynnwys sero gyda swyddogaeth Hidlo yn Excel

Gallwch ddefnyddio'r swyddogaeth Hidlo i hidlo pob rhes yn seiliedig ar y gwerthoedd sero mewn colofn benodol, ac yna dileu'r holl resi gweladwy yn nes ymlaen. Gwnewch fel a ganlyn.

1. Dewiswch y celloedd colofn sy'n cynnwys y gwerthoedd sero rydych chi am ddileu'r rhesi cyfan yn seiliedig arnyn nhw, yna cliciwch Dyddiad > Hidlo. Gweler y screenshot:

2. Yna mae saeth gwympo yn arddangos yng nghell gyntaf y golofn a ddewiswyd, cliciwch y saeth, ac yna dewiswch Hidlau Rhif > Equals o'r rhestr ostwng.

dileu doc ​​os sero 1

3. Yn y AutoFilter Custom blwch deialog, nodwch rif 0 i mewn i'r blwch testun fel isod dangosir y screenshot, ac yna cliciwch ar y OK botwm.

dileu doc ​​os sero 1

4. Yna caiff yr holl gelloedd gwerth sero yn y golofn benodol hon eu hidlo allan. Dewiswch yr holl gelloedd gweladwy yn yr ystod hidlo a chliciwch arnynt, dewiswch Delete Rows o'r ddewislen clicio ar y dde. Ac yn y blwch prydlon popping up, cliciwch y OK botwm. Gweler y screenshot:

dileu doc ​​os sero 1

5. Nawr mae'r holl resi gweladwy yn cael eu dileu. Gallwch glicio Dyddiad > Hidlo eto i ddangos yr holl ddata heb gelloedd gwerth sero. Gweler y screenshot:

dileu doc ​​os sero 1


Dileu pob rhes yn hawdd os oes gwerthoedd sero yn bodoli mewn ystod benodol yn Excel:

Kutools ar gyfer Excel's Dewiswch Gelloedd Penodol mae cyfleustodau yn eich helpu i ddewis rhesi cyfan yn hawdd os oes gwerthoedd sero yn bodoli mewn ystod benodol, ac yna gallwch chi ddileu'r holl resi a ddewiswyd â llaw yn gyflym heb unrhyw gamgymeriadau.
Dadlwythwch a rhowch gynnig arni nawr! (Llwybr am ddim 30 diwrnod)


Dileu rhes os yw'r gell yn cynnwys sero gyda VBA yn Excel

Bydd yr adran hon yn dangos y dull VBA i chi ddileu pob rhes os oes gwerthoedd sero yn bodoli mewn colofn benodol yn Excel.

1. Gwasgwch Alt + F11 allweddi ar yr un pryd i arddangos y Microsoft Visual Basic ar gyfer Ceisiadau ffenestr.

2. Yn ffenestr Microsoft Visual Basic for Applications, cliciwch Mewnosod > Modiwlau, yna copïwch a gludwch y cod VBA canlynol i mewn i ffenestr y modiwl.

VBA: Dileu rhesi cyfan os oes gwerth sero yn bodoli mewn amrediad colofn penodol mewn taflen waith

Is DeleteZeroRow () 'Updateby20140616 Dim Rng As Range Dim WorkRng As Range On Error Ail-ddechrau Next xTitleId = "KutoolsforExcel" Gosod WorkRng = Set Cais.Selection WorkRng = Application.InputBox ("Range", xTitleId, WorkRng.Address, Type: = 8 .

3. Gwasgwch y F5 allwedd i redeg y cod, yn y popping up Kutoolsorexcel blwch deialog, dewiswch yr ystod golofn rydych chi am ddileu rhesi cyfan yn seiliedig ar y gwerthoedd sero y tu mewn, yna cliciwch ar y OK botwm. Gweler y screenshot:

dileu doc ​​os sero 1

Yna caiff yr holl resi sy'n seiliedig ar y gwerthoedd sero yn yr ystod golofn benodol eu dileu ar unwaith.

dileu doc ​​os sero 1


Dileu rhes os yw cell yn cynnwys sero gyda Kutools ar gyfer Excel

I lawer o ddefnyddwyr Excel, mae defnyddio cod VBA yn beryglus i gael gwared ar ddata yn Excel. Os nad ydych yn ymddiried yn union yn y cod VBA, yma rydym yn eich argymell i roi cynnig ar y Dewiswch Gelloedd Penodol cyfleustodau Kutools ar gyfer Excel.

Cyn gwneud cais Kutools ar gyfer Excel, os gwelwch yn dda ei lawrlwytho a'i osod yn gyntaf.

1. Dewiswch yr ystod golofn y byddwch chi'n tynnu rhesi cyfan yn seiliedig ar y gwerthoedd sero y tu mewn, ac yna cliciwch Kutools > dewiswch > Dewiswch Gelloedd Penodol. Gweler y screenshot:

2. Yn y Dewiswch Gelloedd Penodol deialog, mae angen i chi:

(1) Dewiswch y Rhes gyfan opsiwn yn y Math o ddewis adran hon.

(2) Dewiswch Equals yn y cyntaf Math penodol rhestr ostwng, yna nodwch y rhif 0 i mewn i'r blwch testun.

(3) Cliciwch y OK botwm.

3. Mae blwch deialog yn ymddangos i ddweud wrthych faint o resi sydd wedi'u dewis, cliciwch y OK botwm. Nawr mae'r holl resi sydd â'r gwerthoedd sero yn bodoli yn yr ystod golofn benodol yn cael eu dewis. Cliciwch ar y dde i unrhyw res a ddewiswyd, yna cliciwch Dileu yn y ddewislen clicio ar y dde. Gweler y screenshot:

dileu doc ​​os sero 1

Nawr mae'r holl resi sydd â'r gwerthoedd sero yn bodoli yn y golofn benodol yn cael eu dileu ar unwaith. Gweler y screenshot:

dileu doc ​​os sero 1

  Os ydych chi am gael treial am ddim (30 diwrnod) o'r cyfleustodau hwn, cliciwch i'w lawrlwytho, ac yna ewch i gymhwyso'r llawdriniaeth yn ôl y camau uchod.


Dileu rhes os yw cell yn cynnwys sero gyda Kutools ar gyfer Excel


Erthyglau Perthynas:

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 (15)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Despues de utilizar subtotal Como hacer para eliminar las filas involucradas que en el subtotal es igual a 0?
This comment was minimized by the moderator on the site
Insert this in VB new module.
This is with InputBox to delete row which contains that word.

Attribute VB_Name = "FindDelRowByWord"
Sub FindDelRow()
'Updateby20140616
Dim Rng As Range
Dim WorkRng As Range
Dim xRep As String
On Error Resume Next
xTitleId = "ZOK Tools"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
xRep = Application.InputBox("word to delete Row:", "ZOK Tools", , , , , 2)
Application.ScreenUpdating = False
Do
Set Rng = WorkRng.Find(xRep, LookIn:=xlValues)
If Not Rng Is Nothing Then
Rng.EntireRow.Delete
End If
Loop While Not Rng Is Nothing
Application.ScreenUpdating = True
End Sub
This comment was minimized by the moderator on the site
WHAT IF you have a big sheet, and there are rows you want to keep, and others rows that contain certain key words and delete those? the kutools work for me but for one key word that many rows have that key word, the rows were deleted, i just want to have multiple key words to do the same? does this work for the code above?
This comment was minimized by the moderator on the site
Good Day,
Kutools can deal with two key words at the same time. You need to enable its second condition with "And" or "Or". Hope I can help.
This comment was minimized by the moderator on the site
This didn't work for me. It changed all values in my chosen column and the adjacent column to zeros. I must be doing something wrong!
This comment was minimized by the moderator on the site
Hi Sheri,
The code works well in my case. Which Excel verson do you use?
This comment was minimized by the moderator on the site
Hi Crystal. I posted this two years ago so I’m guessing I figured it out. But thanks for the reply.
This comment was minimized by the moderator on the site
Hi dears , I need a code to hide the rows which have the value=0 on the column "N" in the sheet 1. The value of the column "N" will change when update the details on the Sheet 2. that's the time need to un-hide the row. is this possible to do this with Excel formula(without macro and Excel Filters).
This comment was minimized by the moderator on the site
modified for my purpose--thank you for your help: Sub DeleteZeroRow() Dim Rng As Range Dim WorkRng As Range On Error Resume Next xTitleId = "" Application.Calculation = xlManual MsgBox "Set the range you want to remove the unused 0 quantity rows from" Set WorkRng = Application.InputBox("Range", xTitleId, "FG93:FG500", Type:=8) Application.ScreenUpdating = False Sheets("ENTRY").Select Do Set Rng = WorkRng.Find("0", LookIn:=xlValues) If Not Rng Is Nothing Then Rng.EntireRow.Delete End If Loop While Not Rng Is Nothing Application.ScreenUpdating = True Range("FF92").Select Selection.End(xlDown).Select MsgBox "Removed 0's ROWS from column FG--calculating now--please wait" Application.Calculation = xlAutomatic End Sub
This comment was minimized by the moderator on the site
I modified the below code to work for me. This deleted every row in column C that had "Delete" in the cell of column C. Sub Delete_DeleteRows() Set WorkRng = Range("C2:C12000") Application.ScreenUpdating = False Do Set Rng = WorkRng.Find("Delete", LookIn:=xlValues) If Not Rng Is Nothing Then Rng.EntireRow.Delete End If Loop While Not Rng Is Nothing Application.ScreenUpdating = True End Sub
This comment was minimized by the moderator on the site
Hi,
its worked for me, thanks a lot.
if I have multiple sheets? how i can run the script 1 time for all the sheets?
This comment was minimized by the moderator on the site
thanks for the response, worked for me
This comment was minimized by the moderator on the site
I modified the above code to work for me. I wanted to delete every row that had "Delete" in row C. Sub Delete_DeleteRows() Set WorkRng = Range("C2:C12000") Application.ScreenUpdating = False Do Set Rng = WorkRng.Find("Delete", LookIn:=xlValues) If Not Rng Is Nothing Then Rng.EntireRow.Delete End If Loop While Not Rng Is Nothing Application.ScreenUpdating = True End Sub
This comment was minimized by the moderator on the site
Your VB code doesn't work. It deletes all rows with a Zero in the 10s position. I hope no one actually uses this as they will delete data...
This comment was minimized by the moderator on the site
This was a life saver!!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations