Preskoči na glavno vsebino

Kako odstraniti ali izbrisati vsa prečrtana besedila ali znake iz celic v Excelu?

Ta članek govori o odstranjevanju vseh prečrtanih besedil ali znakov iz več celic v Excelu.

Odstranite vsa prečrtana besedila iz celic s kodo VBA


Odstranite vsa prečrtana besedila iz celic s kodo VBA

Spodnja koda VBA vam lahko pomaga odstraniti vsa besedila v celicah, ki so bila označena s prečrtanjem. Naredite naslednje.

1. Na delovnem listu so prečrtana besedila, ki jih morate odstraniti, pritisnite druga + F11 tipke hkrati, da odprete Microsoft Visual Basic za aplikacije okno.

2. V Ljubljani Microsoft Visual Basic za aplikacije okno, kliknite Razširjenje > Moduli. Nato kopirajte in prilepite spodnjo kodo VBA v okno Code.

Koda VBA: iz celic odstranite vsa prečrtana besedila

Sub DelStrikethroughText()
    Dim xRg As Range, xCell As Range
    Dim xStr As String
    Dim I As Long
    On Error Resume Next
    Set xRg = Application.InputBox("Please select range:", "KuTools For Excel", Selection.Address, , , , , 8)
    If xRg Is Nothing Then Exit Sub
    Application.ScreenUpdating = Fase
        For Each xCell In xRg
            If IsNumeric(xCell.Value) And xCell.Font.Strikethrough Then
                xCell.Value = ""
            ElseIf Not IsNumeric(xCell.Value) Then
                For I = 1 To Len(xCell)
                    With xCell.Characters(I, 1)
                        If Not .Font.Strikethrough Then
                            xStr = xStr & .Text
                        End If
                    End With
                Next
                xCell.Value = xStr
                xStr = ""
            End If
        Next
    Application.ScreenUpdating = True
End Sub

3. Pritisnite F5 ali kliknite Run za zagon kode. V pojavnem oknu Kutools za Excel v pogovornem oknu izberite obseg, ki vsebuje prečrtana besedila, ki jih boste odstranili, in kliknite na OK . Oglejte si posnetek zaslona:

Nato se vsa besedila, označena s prečrtanjem, takoj odstranijo iz celic, kot je prikazano spodaj.


Sorodni članki:

Najboljša pisarniška orodja za produktivnost

🤖 Kutools AI Aide: Revolucionirajte analizo podatkov na podlagi: Inteligentna izvedba   |  Ustvari kodo  |  Ustvarite formule po meri  |  Analizirajte podatke in ustvarite grafikone  |  Prikličite funkcije Kutools...
Priljubljene funkcije: Poiščite, označite ali identificirajte dvojnike   |  Izbriši prazne vrstice   |  Združite stolpce ali celice brez izgube podatkov   |   Krog brez formule ...
Super iskanje: Več kriterijev VLookup    Multiple Value VLookup  |   VLookup na več listih   |   Nejasno iskanje ....
Napredni spustni seznam: Hitro ustvarite spustni seznam   |  Odvisni spustni seznam   |  Večkrat izberite spustni seznam ....
Upravitelj stolpcev: Dodajte določeno število stolpcev  |  Premakni stolpce  |  Preklop stanja vidnosti skritih stolpcev  |  Primerjaj obsege in stolpce ...
Predstavljene funkcije: Mrežni fokus   |  Pogled oblikovanja   |   Velika vrstica formule    Upravitelj delovnih zvezkov in listov   |  Knjižnica virov (Samodejno besedilo)   |  Izbirnik datuma   |  Združite delovne liste   |  Šifriranje/dešifriranje celic    Pošljite e-pošto po seznamu   |  Super filter   |   Poseben filter (filter krepko/ležeče/prečrtano ...) ...
15 najboljših kompletov orodij12 Besedilo Orodja (dodajanje besedila, Odstrani znake,...)   |   50 + Graf Vrste (Gantt Chart,...)   |   40+ Praktično Formule (Izračunajte starost glede na rojstni dan,...)   |   19 vstavljanje Orodja (Vstavite kodo QR, Vstavi sliko s poti,...)   |   12 Pretvorba Orodja (Številke v besede, Pretvorba valut,...)   |   7 Spoji in razdeli Orodja (Napredne kombinirane vrstice, Razdeljene celice,...)   |   ... in več

Napolnite svoje Excelove spretnosti s Kutools za Excel in izkusite učinkovitost kot še nikoli prej. Kutools za Excel ponuja več kot 300 naprednih funkcij za povečanje produktivnosti in prihranek časa.  Kliknite tukaj, če želite pridobiti funkcijo, ki jo najbolj potrebujete...

Opis


Kartica Office prinaša vmesnik z zavihki v Office in poenostavi vaše delo

  • Omogočite urejanje in branje z zavihki v Wordu, Excelu, PowerPointu, Publisher, Access, Visio in Project.
  • Odprite in ustvarite več dokumentov v novih zavihkih istega okna in ne v novih oknih.
  • Poveča vašo produktivnost za 50%in vsak dan zmanjša na stotine klikov miške za vas!
Comments (10)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hey guys, this worked for me but in some cases it somehow changes the text which is not formatted as strikethrough as strikethrough. Easy fix to go back and spotcheck the data in specific instances and un-strikethrough the range.
This comment was minimized by the moderator on the site
Hi,Which Excel version are you using?
This comment was minimized by the moderator on the site
I use it for the whole column and my excel never come back....
This comment was minimized by the moderator on the site
Hi san,
Would you provide the Excel version you are using?
The code works well in my case.
Sorry for the inconvenience.
This comment was minimized by the moderator on the site
can it be done through python, pandas ?
If yes can anybody help me out how to implement this ?
This comment was minimized by the moderator on the site
Hi Girish,
The code hasn't been tested in python, pandas. Sorry can't help you with that. Thanks for commenting.
This comment was minimized by the moderator on the site
This does not work. Excel goes into Not Responding.
This comment was minimized by the moderator on the site
It works in small scale. I assume that the reason it goes into Not Responding is because the Macro takes forever when you have a lot of data to get through. This Macro is checking every single character for strike through.

I would recommend adding code that reformats the cell when it is done because I had several cells where the code removed the strikethrough text but the remaining text was still in strikethrough. I believe this is because the formatting of the full cell was strikethrough with the non strikethrough text being formatted differently, so just an FYI.
This comment was minimized by the moderator on the site
Good day,
Sorry for the inconvenience. Would you provide your Office version? Thanks for your comment.
This comment was minimized by the moderator on the site
Same here.

I am using Office 365 ProPlus
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations