Skip i'r prif gynnwys

Sut i ddewis pob rhes arall neu nawfed yn Excel?

Awdur: Xiaoyang Wedi'i Addasu Diwethaf: 2020-05-21

Pan ddefnyddiwn daflen waith, weithiau, mae angen i ni ddewis rhes arall neu nawfed y ddalen at ddibenion fformatio, dileu neu gopïo. Gallwch eu dewis â llaw, ond os oes cannoedd o resi, nid yw'r dull hwn yn ddewis da. Dyma rai triciau i'ch helpu chi.

Dewiswch bob rhes arall neu nawfed gyda VBA

Dewiswch bob rhes arall neu nth gyda Kutools ar gyfer Excelsyniad da3


Dewiswch bob rhes arall neu nawfed gyda VBA

Yn yr enghraifft hon, byddaf yn dewis un rhes gyda dwy egwyl. Gyda chod VBA, gallaf ei orffen fel a ganlyn:

1. Tynnwch sylw at yr ystod rydych chi am ei dewis bob yn ail neu nawfed rhes.

2.Click Datblygwr > Visual Basic, Newydd Microsoft Visual Basic ar gyfer cymwysiadau ffenestr yn cael ei harddangos, cliciwch Mewnosod > Modiwlau, a mewnbynnu'r cod canlynol i'r Modiwl:

Sub EveryOtherRow()
Dim rng As Range
Dim InputRng As Range
Dim OutRng As Range
Dim xInterval As Integer
xTitleId = "KutoolsforExcel"
Set InputRng = Application.Selection
Set InputRng = Application.InputBox("Range :", xTitleId, InputRng.Address, Type:=8)
xInterval = Application.InputBox("Enter row interval", xTitleId, Type:=1)
For i = 1 To InputRng.Rows.Count Step xInterval + 1
    Set rng = InputRng.Cells(i, 1)
    If OutRng Is Nothing Then
        Set OutRng = rng
    Else
        Set OutRng = Application.Union(OutRng, rng)
    End If
Next
OutRng.EntireRow.Select
End Sub

3. Yna cliciwch doc-lluosi-cyfrifo-3 botwm i redeg y cod. Ac mae deialog yn ymddangos i chi ddewis ystod. Gweler y screenshot:



4. Cliciwch OK, ac yn yr achos hwn, rwy'n mewnbynnu 3 yn y dialog naidlen arall fel y rhes egwyl. Gweler y screenshot

5. Cliciwch OK, ac mae pob trydydd rhes wedi ei ddewis. Gweler y screenshot:

Gallwch chi newid yr egwyl yn ôl yr angen Kutoolsorexcel deialog.


Dewiswch bob rhes arall neu nth gyda Kutools ar gyfer Excel

Gyda chod VBA, dim ond un rhes gyda chyfyngau penodol y gallwch eu dewis, os bydd angen i chi ddewis dwy, tair neu res arall gyda chyfyngau penodol, y Kutools ar gyfer Excel yn gallu'ch helpu chi i ddatrys y broblem hon yn hawdd ac yn gyfleus.

Kutools ar gyfer Excel, gyda mwy na 300 swyddogaethau defnyddiol, yn gwneud eich swyddi yn haws. 

Ar ôl gosod am ddim Kutools ar gyfer Excel, gwnewch fel isod:

1. Cliciwch Kutools > Select > Select Interval Rows & Columns…, Gweler y screenshot:

doc dewis pob rhes arall8

2. Yn y  Select Interval Rows & Columns blwch deialog, cliciwchdoc-disodli-ystod-enwau-7 botwm i ddewis yr ystod sydd ei hangen arnoch chi, dewiswch Rows or Columns o Select adran, a nodwch y rhif rydych chi ei eisiau yn y Interval of blwch mewnbwn a Rows blwch mewnbwn. Gweler y screenshot:

doc dewis pob rhes arall9

doc dewis pob rhes arall10

Nodiadau:
1. Os oes angen i chi ddewis pob rhes arall yn y dewis, nodwch 2 yn y blwch Cyfnodau Mewnbwn ac 1 yn y blwch Rows blwch mewnbwn.

2. Os ydych chi am ddewis y rhes gyfan sydd ei hangen arnoch chi, gallwch chi wirio Select entire rows opsiwn.
doc dewis pob rhes arall11


Cysgodi pob rhes arall neu nth rhes gyda Kutools ar gyfer Excel

Os ydych chi am gysgodi ystodau ym mhob rhes arall fel bod y data'n edrych yn fwy rhagorol fel islaw'r screenshot a ddangosir, gallwch wneud cais Kutools ar gyfer Excel'S Alternate Row/Column Shading swyddogaeth i drin y swydd yn gyflym.

doc dewis pob rhes arall12
saeth doc i lawr
doc dewis pob rhes arall13

Ar ôl gosod am ddim Kutools ar gyfer Excel, gwnewch fel isod:

1. Dewiswch yr ystod o gelloedd rydych chi am eu cysgodi, cliciwch Kutools > Format > Alternate Row/Column Shading.
doc dewis pob rhes arall14

2. Yn y Alternate Row/Column Shading deialog, gwnewch fel y rhain:

1) Dewiswch y rhesi neu'r colofnau rydych chi am eu cysgodi;

2) Dewiswch Conditional formatting or fformatio safonol yn ôl yr angen;

3) Nodwch yr egwyl cysgodi;

4) Dewiswch liw cysgodi.
doc dewis pob rhes arall15

3. Cliciwch Ok. Nawr mae'r amrediad wedi'i gysgodi ym mhob nawfed rhes.

Os ydych chi am gael gwared â'r cysgodi, gwiriwch Tynnwch y cysgodi rhes bob yn ail opsiwn i mewn Cysgod Rhes / Colofn Amgen deialog.


Erthyglau cysylltiedig:

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 (12)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Help, please. This looks great, BUT when I hit the > Run button it fails with a "Compile error: Sub or Function not defined" and the code stopped at "Set rng = InputRng.Rows.Count Step xInterval +1".
This comment was minimized by the moderator on the site
Also I don't get how "Set" and "Step" could ever work together
This comment was minimized by the moderator on the site
Not sure that I will be able to help, but.. First of, there is a spacing between "C" and "ount" in "Count" when i copied your code string over to a module. Secondly, I can´t find your code anywhere else on this page, please submit the whole thing, if the problem remains.
This comment was minimized by the moderator on the site
Replace OutRng.EntireRow.Select with Intersect(OutRng.EntireRow, InputRng).Select if you want every other row within your selection
This comment was minimized by the moderator on the site
really good, thanks!
This comment was minimized by the moderator on the site
The code has one request. Does it have to select the ENTIRE ROW for each nth row? Can't it just select certain cells (range of cells) within each nth row? I don't need all the information in each row. Just certain cells of each nth row.
This comment was minimized by the moderator on the site
I made the modifications below to select 30 rows Sub EveryOtherRow() Dim rng As Range Dim InputRng As Range Dim OutRng As Range Dim xInterval As Integer xTitleId = "KutoolsforExcel" Set InputRng = Application.Selection Set InputRng = Application.InputBox("Range :", xTitleId, InputRng.Address, Type:=8) xInterval = Application.InputBox("Enter row interval", xTitleId, Type:=1) For i = 1 To InputRng.Rows.Count Step xInterval + 1 Set rng = InputRng.Cells(i, 1).Resize(, 30) 'Resize to the number of columns to select, 30 in this case If OutRng Is Nothing Then Set OutRng = rng Else Set OutRng = Application.Union(OutRng, rng) End If Next OutRng.Select 'Use OutRng.EntireRow.Select to select the entire row End Sub
This comment was minimized by the moderator on the site
Nice, thanks, this was very helpful ^_^
This comment was minimized by the moderator on the site
fanatastic. thanks a lot.it works perfect.I have more than 7000 data that need to select them with different interval.this trick was like a miracle for me.thaaaaaaaanks.
This comment was minimized by the moderator on the site
I'm trying to use the VBA macro in Excel 2010. It will only select the first nth row, not all of them in the selection. If I run it again, it will go to the next. Any idea what I'm doing wrong? Thanks!
This comment was minimized by the moderator on the site
Just saved my ass with this code thanks! My matlab decided to randomly stop working and so I had to resort to excel which I am not as familiar with as with Matlab. This def. helped. Thanks.
This comment was minimized by the moderator on the site
I need to select multiple rows and a fixed interval and move to the other sheet please answer me as soon as possible 
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations