Skip i'r prif gynnwys

Sut i fewnosod rhes wag uwchben testun penodol yn Excel?

mewnosod doc rhes uwchben testun penodol 1 2 mewnosod doc rhes uwchben testun penodol 2

Pan fyddwch chi'n gweithio ar daflen waith, a ydych chi erioed wedi ceisio mewnosod rhes wag uwchben testun penodol mewn colofn? Er enghraifft, mae rhai enwau yng ngholofn A, nawr, rwyf am fewnosod rhesi gwag uwchben y celloedd sy'n cynnwys yr enw “Mike” fel y dangosir y screenshot chwith, efallai, nid oes unrhyw ffordd uniongyrchol ichi ddatrys y dasg hon yn Excel . Yr erthygl hon, byddaf yn siarad am rai triciau da ar gyfer delio â'r swydd hon yn Excel.

Mewnosod rhes wag uwchben testun penodol gyda chod VBA

Mewnosodwch rhes wag uwchben testun penodol gyda Kutools ar gyfer Excel


Mewnosod rhes wag uwchben testun penodol gyda chod VBA

Bydd mewnosod rhes wag uwchben y testun penodol â llaw fesul un yn gwastraffu llawer o amser, yma, byddaf yn creu cod VBA i chi fewnosod y rhes wag uwchben gwerth celloedd penodol ar unwaith.

1. Daliwch i lawr y ALT + F11 allweddi, ac mae'n agor y Microsoft Visual Basic ar gyfer Ceisiadau ffenestr.

2. Cliciwch Mewnosod > Modiwlau, ac yna pastiwch y macro canlynol yn y Modiwlau Ffenestr.

Cod VBA: Mewnosod rhes wag uwchben testun penodol yn gyflym

Sub test1()
'updateby Extendoffice
    Dim i As Long
    Dim xLast As Long
    Dim xRng As Range
    Dim xTxt As String
    On Error Resume Next
    xTxt = Application.ActiveWindow.RangeSelection.Address
    Set xRng = Application.InputBox("please select the column with specific text:", "Kutools for Excel", xTxt, , , , , 8)
    If xRng Is Nothing Then Exit Sub
    If (xRng.Columns.Count > 1) Then
        MsgBox "the selected range must be one column", , "Kutools for Excel"
        Exit Sub
    End If
    xLast = xRng.Rows.Count
    For i = xLast To 1 Step -1
      If InStr(1, xRng.Cells(i, 1).Value, "Mike") > 0 Then
        Rows(xRng.Cells(i, 1).Row).Insert shift:=xlDown
      End If
    Next
End Sub

3. Yna pwyswch F5 allwedd i redeg y cod hwn, a bydd blwch deialog yn popio allan i'ch atgoffa i ddewis y data colofn sy'n cynnwys testun penodol rydych chi am ei fewnosod rhes uchod, gweler y screenshot:

mewnosod doc rhes uwchben testun penodol 3

4. Ac yna cliciwch OK botwm, mae'r rhesi gwag wedi'u mewnosod uwchben y testun penodol “Mike”.

Nodyn: Yn y cod uchod, gallwch newid gwerth y testun “Mike”I unrhyw werthoedd eraill yr oeddech yn eu dymuno o'r sgript Os yw InStr (1, xRng.Cells (i, 1) .Value, "Mike")> 0 yna.


Mewnosodwch rhes wag uwchben testun penodol gyda Kutools ar gyfer Excel

Os oes gennych Kutools ar gyfer Excel, Gyda'i Dewiswch Gelloedd Penodol nodwedd, gallwch ddewis y gwerthoedd celloedd penodedig yn gyntaf, ac yna cymhwyso cyfleustodau Excel In Sheet Rows i fewnosod y rhesi gwag ar unwaith.

Kutools ar gyfer Excel : gyda mwy na 300 o ychwanegiadau Excel defnyddiol, am ddim i geisio heb unrhyw gyfyngiad mewn 30 diwrnod

Ar ôl gosod Kutools ar gyfer Excel, gwnewch fel a ganlyn:

1. Dewiswch yr ystod ddata rydych chi am ei defnyddio.

2. Yna cliciwch Kutools > dewiswch > Dewiswch Gelloedd Penodol, gweler y screenshot:

3. Yn y Dewiswch Gelloedd Penodol blwch deialog, dewiswch Cell O dan y Math o ddewis, ac yna nodwch y meini prawf sydd eu hangen arnoch o dan y Math penodol adran, yn yr achos hwn, byddaf yn dewis Equals oddi wrth y Math penodol, a nodi'r enw yr wyf am ei ddewis, gweler y screenshot:

mewnosod doc rhes uwchben testun penodol 5

4. Yna cliciwch Ok botwm, mae'r holl gelloedd sy'n werth Mike yn cael eu dewis ar unwaith, gweler y screenshot:

mewnosod doc rhes uwchben testun penodol 6

5. Ar ôl dewis y celloedd testun penodol, cliciwch Hafan > Mewnosod > Mewnosod Rhesi Dalen, a bydd y rhesi gwag yn cael eu mewnosod uwchben y testun a ddewiswyd, gweler sgrinluniau:

mewnosod doc rhes uwchben testun penodol 7 2 mewnosod doc rhes uwchben testun penodol 2

 Dadlwythwch a threial am ddim Kutools ar gyfer Excel Nawr !


Demo: Mewnosod rhes wag uwchben testun penodol gyda Kutools ar gyfer Excel

Kutools ar gyfer Excel: gyda mwy na 300 o ychwanegiadau Excel defnyddiol, am ddim i geisio heb unrhyw gyfyngiad mewn 30 diwrnod. Dadlwythwch a threial am ddim Nawr!

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
I try do it to put a blank row after every non-empty cell, but excel says. "That command cannot be used on multiple selections"
Why it dosnt work for me???
This comment was minimized by the moderator on the site
Is there a way not to appears dialog box with pop out to remind me to select the column data which contains specific text I want to insert row above, If a specified cell is filled with data, then process run automatically , without promptings, and insert row above?
This comment was minimized by the moderator on the site
This has been amazing for the data I have. I was wondering if you could help me one step further. I have been able to split my data based on this, but then I need to colour code my groups of data. When I split my data I have a variable number of rows from 1-50, and I have 36 columns of data including 32 columns that I need to compare the values within to the top row. I am currently manually selecting each group (as separated by a blank row) and then using ctrl+shift+| to highlight column differences, and formatting those cells to highlight the differences.


Is there anyone who could write a code to select and format those column differences within the groupings, using the blank row as a separator?
This comment was minimized by the moderator on the site
Hi, i have a similar problem as the one above. What if i want to select the cell below a specified criteria? For example, you can use the example from above. i want to select the cell below "Mike". is there any easy way out?
This comment was minimized by the moderator on the site
@SSJ did you ever find a solution?
This comment was minimized by the moderator on the site
Hello, guys,

To insert blank rows below a specific cell value, you can apply the following code:

Sub BlankLine()
Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Set WorkRng = WorkRng.Columns(1)
xLastRow = WorkRng.Rows.Count
Application.ScreenUpdating = False
For xRowIndex = xLastRow To 1 Step -1
Set Rng = WorkRng.Range("A" & xRowIndex)
If Rng.Value = "Mike" Then
Rng.Offset(1, 0).EntireRow.Insert Shift:=xlDown
End If
Next
Application.ScreenUpdating = True
End Sub

Please change the criteria "Mike" to your own cell value.

Hope it can help you, thank you!
This comment was minimized by the moderator on the site
thank you! its worked.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations