Vai al contenuto principale

Come rimuovere o eliminare tutti i testi oi caratteri barrati dalle celle in Excel?

Questo articolo parla della rimozione di tutti i testi o caratteri barrati da più celle in Excel.

Rimuovi tutti i testi barrati dalle celle con codice VBA


Rimuovi tutti i testi barrati dalle celle con codice VBA

Il codice VBA di seguito può aiutarti a rimuovere tutti i testi nelle celle che sono state contrassegnate con barrato. Si prega di fare quanto segue.

1. Nel foglio di lavoro contiene i testi barrati che è necessario rimuovere, premere il tasto altro + F11 tasti contemporaneamente per aprire il file Microsoft Visual Basic, Applications Edition finestra.

2. Nel Microsoft Visual Basic, Applications Edition finestra, fare clic Inset > Moduli. Quindi copia e incolla sotto il codice VBA nella finestra del codice.

Codice VBA: rimuovi tutti i testi barrati dalle celle

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. premi il F5 o fare clic su Correre pulsante per eseguire il codice. Nel spuntare Kutools for Excel finestra di dialogo, selezionare l'intervallo che contiene i testi barrati da rimuovere, quindi fare clic su OK pulsante. Vedi screenshot:

Quindi tutti i testi contrassegnati con un barrato vengono rimossi dalle celle immediatamente come mostrato nell'immagine sottostante.


Articoli correlati:

I migliori strumenti per la produttività in ufficio

🤖 Assistente AI di Kutools: Rivoluziona l'analisi dei dati basandosi su: Esecuzione intelligente   |  Genera codice  |  Crea formule personalizzate  |  Analizzare i dati e generare grafici  |  Richiama le funzioni di Kutools...
Funzioni popolari: Trova, evidenzia o identifica i duplicati   |  Elimina righe vuote   |  Combina colonne o celle senza perdere dati   |   Round senza formula ...
Super ricerca: VLookup a criteri multipli    VLookup a valori multipli  |   VLookup su più fogli   |   Ricerca fuzzy ....
Elenco a discesa avanzato: Crea rapidamente un elenco a discesa   |  Elenco a discesa dipendente   |  Elenco a discesa a selezione multipla ....
Gestore di colonna: Aggiungi un numero specifico di colonne  |  Sposta colonne  |  Attiva/disattiva lo stato di visibilità delle colonne nascoste  |  Confronta intervalli e colonne ...
Funzionalità in primo piano: Messa a fuoco della griglia   |  Vista di progettazione   |   Grande barra delle formule    Gestore di cartelle di lavoro e fogli   |  Resource Library (Testo automatico)   |  Date picker   |  Combina fogli di lavoro   |  Crittografa/decrittografa le celle    Invia e-mail per elenco   |  Super filtro   |   Filtro speciale (filtro grassetto/corsivo/barrato...) ...
I 15 migliori set di strumenti12 Testo Strumenti (aggiungi testo, Rimuovi personaggi, ...)   |   50+ Grafico Tipi (Diagramma di Gantt, ...)   |   40+ Pratico Formule (Calcola l'età in base al compleanno, ...)   |   19 Inserimento Strumenti (Inserisci il codice QR, Inserisci immagine dal percorso, ...)   |   12 Conversione Strumenti (Numeri in parole, Conversione di valuta, ...)   |   7 Unisci e dividi Strumenti (Combina righe avanzate, Celle divise, ...)   |   ... e altro ancora

Potenzia le tue competenze di Excel con Kutools per Excel e sperimenta l'efficienza come mai prima d'ora. Kutools per Excel offre oltre 300 funzionalità avanzate per aumentare la produttività e risparmiare tempo.  Fai clic qui per ottenere la funzionalità di cui hai più bisogno...

Descrizione


Office Tab porta l'interfaccia a schede in Office e semplifica notevolmente il tuo lavoro

  • Abilita la modifica e la lettura a schede in Word, Excel, PowerPoint, Publisher, Access, Visio e Project.
  • Apri e crea più documenti in nuove schede della stessa finestra, piuttosto che in nuove finestre.
  • Aumenta la produttività del 50% e riduce ogni giorno centinaia di clic del mouse!
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